简体   繁体   English

配置Json的IIS动态压缩

[英]Configuring IIS dynamic compression of Json

I'm having problems testing the dynamicCompression of my Json output. 我在测试Json输出的dynamicCompression时遇到问题。 The Application is an MVC/WEBAPI5 application and the request I'm investigating is a Get WebAPI request. Application是一个MVC / WEBAPI5应用程序,我正在调查的请求是Get WebAPI请求。

Im getting Json back but its not being compressed. 我让Json回来但没有被压缩。

I've followed the steps to configure dynamic compression of Json in IIS8 in How can I get gzip compression in IIS7 working? 我已经按照步骤在IIS8中配置Json的动态压缩了如何在IIS7中使用gzip压缩?

as : 如:

 <httpCompression directory="%SystemDrive%\inetpub\temp\IIS Temporary Compressed Files">
        <scheme name="gzip" dll="%Windir%\system32\inetsrv\gzip.dll" />
        <dynamicTypes>
            <add mimeType="text/*" enabled="true" />
            <add mimeType="message/*" enabled="true" />
            <add mimeType="application/x-javascript" enabled="true" />
            <add mimeType="application/javascript" enabled="true" />
            <add mimeType="application/json" enabled="true" />
            <add mimeType="application/json; charset=utf-8" enabled="true" />
            <add mimeType="*/*" enabled="false" />
        </dynamicTypes>
        <staticTypes>
            <add mimeType="text/*" enabled="true" />
            <add mimeType="message/*" enabled="true" />
            <add mimeType="application/javascript" enabled="true" />
            <add mimeType="application/atom+xml" enabled="true" />
            <add mimeType="application/xaml+xml" enabled="true" />
            <add mimeType="*/*" enabled="false" />
        </staticTypes>
    </httpCompression>

I have the compression module installed and i can see the following in the FailedRequestTracelog for this particular call: 我安装了压缩模块,我可以在FailedRequestTracelog中看到以下特定调用的以下内容: 在此输入图像描述

You can see in my fiddler trace that it does seem to be a matching type despite it saying this is not the case in the FailedRequestTrace output. 您可以在我的fiddler跟踪中看到它看起来似乎是一个匹配的类型,尽管它说FailedRequestTrace输出中不是这种情况。 在此输入图像描述

Any ideas? 有任何想法吗?

You can take a look at my below blog post on one way of doing compression in Web API. 您可以在Web API中查看我在下面的博客文章中进行压缩的一种方法。 http://blogs.msdn.com/b/kiranchalla/archive/2012/09/04/handling-compression-accept-encoding-sample.aspx http://blogs.msdn.com/b/kiranchalla/archive/2012/09/04/handling-compression-accept-encoding-sample.aspx

If you would like to use IIS for compression, take a look at the following post: https://stackoverflow.com/a/17331627/1184056 如果您想使用IIS进行压缩,请查看以下帖子: https//stackoverflow.com/a/17331627/1184056

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM