IIS 配置 GZip
2016-06-21 17:30
267 查看
up v20down voteaccepted | I think you should not do this in an action filter as the modelbinding stage happens before action filters are executed and during modelbinding the formatters could be reading the stream to deserialize it, in which case it would fail. If you are using IIS, then do the following to setup compression(The following have some snippets from Scott Hanselman's blog post): Enabled the "Dynamic Compression" feature in IIS. Back in IIS Manager, go to the page for the SERVER, not the SITE. Click on Configuration Editor: From the dropdown, select system.webServer/httpCompression: Then click on Dynamic Types and now that you're in the list editor, think about what types you want compressed. By default / is False, but you could just turn that on. I chose to be a little more picky and added application/atom+xml, application/json, and application/atom+xml;charset=utf-8 as seen below. It's a little gotcha that application/atom+xml and application/atom+xml;charset=utf-8 are separate entries. Feel free to add what ever mimeTypes you like in here. After you've added them and closed the dialog, be sure to click Apply and Restart your IIS Service to load the new module. Now make requests using Accept-Encodingheader and you should see the response as expected. EDIT ( in addition to above include "application/json; charset=utf-8" to cover both json formats) | |||
相关文章推荐
- 校验和计算
- YII2 请求源码分析
- 利用php截取字符去掉最后一个字符
- Lombok 安装、入门 - 消除冗长的 java 代码
- Java中对于文件读取写入需要注意的事项
- linux makefile
- 根据Type 变量动态创建可变内部类型的泛型
- Trapping Rain Water LeetCode JavaScript JS
- 委托
- getResourceAsStream returns null
- ArrayList
- 运用Fluxion高效破解WiFi密码
- 其他软件的使用问题记录
- 第6章 软负载中心与集中配置管理
- Java多线程编程中ThreadLocal类的用法及深入
- eclipse集成weblogic开发环境的搭建
- [Scala--基础]--windows 10安装、配置环境变量步骤
- 在Android Studio中设置或修改默认的Android SDK路径。
- 第十三周项目二动物这样叫一
- 正则应用篇