Configuring IIS 7.5 to send JSON responses gzipped,Dynamic Compression
来源:互联网 发布:知乎账号被停用怎么办 编辑:程序博客网 时间:2024/05/04 19:38
http://stackoverflow.com/questions/11617744/configuring-iis-7-5-to-send-json-responses-gzipped-no-matching-content-type
1.Install Dynamic Compression as IIS feature
2.You want to make sure that the */*
mime type is after the types you add. Also make sure that you have installed Dynamic Compression Module using Server Manager (or OptionalFeatures.exe)
This is the command lines I use to make sure a good compression is done. (but make sure you actually have installed Dynamic and Static Compression modules):
run.bat
call %windir%\system32\inetsrv\appcmd.exe set config -section:system.webServer/serverRuntime /frequentHitThreshold:"1"call %windir%\system32\inetsrv\appcmd.exe set config -section:system.webServer/urlCompression /doDynamicCompression:"True"call %windir%\system32\inetsrv\appcmd.exe set config -section:system.webServer/httpCompression /-"dynamicTypes.[mimeType='application/json']"call %windir%\system32\inetsrv\appcmd.exe set config -section:system.webServer/httpCompression /+"dynamicTypes.[mimeType='application/json',enabled='True']"call %windir%\system32\inetsrv\appcmd.exe set config -section:system.webServer/httpCompression /-"dynamicTypes.[mimeType='application/json; charset=utf-8']"call %windir%\system32\inetsrv\appcmd.exe set config -section:system.webServer/httpCompression /+"dynamicTypes.[mimeType='application/json; charset=utf-8',enabled='True']"call %windir%\system32\inetsrv\appcmd.exe set config -section:system.webServer/httpCompression /-"dynamicTypes.[mimeType='application/javascript']"call %windir%\system32\inetsrv\appcmd.exe set config -section:system.webServer/httpCompression /+"dynamicTypes.[mimeType='application/javascript',enabled='True']"call %windir%\system32\inetsrv\appcmd.exe set config -section:system.webServer/httpCompression /-"dynamicTypes.[mimeType='application/x-javascript']"call %windir%\system32\inetsrv\appcmd.exe set config -section:system.webServer/httpCompression /+"dynamicTypes.[mimeType='application/x-javascript',enabled='True']"call %windir%\system32\inetsrv\appcmd.exe set config -section:system.webServer/httpCompression /-"dynamicTypes.[mimeType='application/x-javascript; charset=utf-8']"call %windir%\system32\inetsrv\appcmd.exe set config -section:system.webServer/httpCompression /+"dynamicTypes.[mimeType='application/x-javascript; charset=utf-8',enabled='True']"call %windir%\system32\inetsrv\appcmd.exe set config -section:system.webServer/httpCompression /-"dynamicTypes.[mimeType='*/*']"call %windir%\system32\inetsrv\appcmd.exe set config -section:system.webServer/httpCompression /+"dynamicTypes.[mimeType='*/*',enabled='False']"call %windir%\system32\inetsrv\appcmd.exe set config -section:system.webServer/httpCompression /-"staticTypes.[mimeType='application/javascript']"call %windir%\system32\inetsrv\appcmd.exe set config -section:system.webServer/httpCompression /+"staticTypes.[mimeType='application/javascript',enabled='True']"call %windir%\system32\inetsrv\appcmd.exe set config -section:system.webServer/httpCompression /-"staticTypes.[mimeType='application/x-javascript']"call %windir%\system32\inetsrv\appcmd.exe set config -section:system.webServer/httpCompression /+"staticTypes.[mimeType='application/x-javascript',enabled='True']"call %windir%\system32\inetsrv\appcmd.exe set config -section:system.webServer/httpCompression /-"staticTypes.[mimeType='application/x-javascript; charset=utf-8']"call %windir%\system32\inetsrv\appcmd.exe set config -section:system.webServer/httpCompression /+"staticTypes.[mimeType='application/x-javascript; charset=utf-8',enabled='True']"call %windir%\system32\inetsrv\appcmd.exe set config -section:system.webServer/httpCompression /-"staticTypes.[mimeType='*/*']"call %windir%\system32\inetsrv\appcmd.exe set config -section:system.webServer/httpCompression /+"staticTypes.[mimeType='*/*',enabled='False']"call %windir%\system32\inetsrv\appcmd.exe set config -section:system.webServer/httpCompression /noCompressionForHttp10:"False" /noCompressionForProxies:"False" /minFileSizeForComp:"2700"
After running this your %windir%\system32\inetsrv\config\ApplicationHost.config should look something like (note that / is at the bottom):
<httpCompression directory="%SystemDrive%\inetpub\temp\IIS Temporary Compressed Files" minFileSizeForComp="2700" noCompressionForHttp10="false" noCompressionForProxies="false"> <scheme name="gzip" dll="%Windir%\system32\inetsrv\gzip.dll" /> <dynamicTypes> <add mimeType="text/*" enabled="true" /> <add mimeType="message/*" enabled="true" /> <add mimeType="application/json" enabled="true" /> <add mimeType="application/json; charset=utf-8" enabled="true" /> <add mimeType="application/javascript" enabled="true" /> <add mimeType="application/x-javascript" enabled="true" /> <add mimeType="application/x-javascript; charset=utf-8" enabled="true" /> <add mimeType="*/*" enabled="false" /> </dynamicTypes> <staticTypes> <add mimeType="text/*" enabled="true" /> <add mimeType="message/*" enabled="true" /> <add mimeType="application/atom+xml" enabled="true" /> <add mimeType="application/xaml+xml" enabled="true" /> <add mimeType="application/javascript" enabled="true" /> <add mimeType="application/x-javascript" enabled="true" /> <add mimeType="application/x-javascript; charset=utf-8" enabled="true" /> <add mimeType="*/*" enabled="false" /> </staticTypes></httpCompression>
0 0
- Configuring IIS 7.5 to send JSON responses gzipped,Dynamic Compression
- IIS http/Json compression
- oam Not Send Authorization Responses
- Configuring git send-email to use Gmail SMTP
- JSON Compression
- Dynamic range compression
- Configuring IIS 5.1 to run an MVC application
- Json format to send notification from Parse
- http.compression IIS
- Configuring ELMAH to send emails without putting your password in the config file
- Configuring IIS to Run 32-bit ASP.NET Applications on 64-bit Windows (IIS 6.0)
- Dynamic range compression/Dynamic range control
- JSON Compression algorithms
- IIS Compression in IIS6.0
- Parsing REST Services JSON Responses (C#)
- Introduction to JPEG Compression
- Configuring IIS for Silverlight Applications
- Configuring Application pool of IIS
- 如何有效的进行--时间管理----阿冬专栏
- iPhone/iOS获得基站信息[整理]
- mysql my.ini内容详细说明
- Mybatis初学三
- c++primer之函数(返回类型和return语句)
- Configuring IIS 7.5 to send JSON responses gzipped,Dynamic Compression
- Javascript(二)-01-(全局和局部变量)
- MongoDB之分片
- 非计算机专业的伟伯是如何拿到阿里Offer的。求职励志!!!
- Atitit.ati orm的设计and架构总结 适用于java c# php版
- jsonp解决ajax跨域问题!
- 一道算法题,看看大家的思路
- Javascript(二)-02-(常见对象-Object)
- 中断处理介绍