gpt4 book ai didi

asp.net - 配置IIS动态压缩Json

转载 作者:行者123 更新时间:2023-12-01 22:26:24 25 4
gpt4 key购买 nike

我在测试 Json 输出的动态压缩时遇到问题。该应用程序是一个 MVC/WEBAPI5 应用程序,我正在调查的请求是一个 Get WebAPI 请求。

我正在取回 Json,但它没有被压缩。

我已按照 How can I get gzip compression in IIS7 working? 中的步骤在 IIS8 中配置 Json 的动态压缩。

如:

 <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>

我安装了压缩模块,并且可以在该特定调用的 FailedRequestTracelog 中看到以下内容: enter image description here

您可以在我的 fiddler 跟踪中看到它似乎确实是匹配的类型,尽管它说 FailedRequestTrace 输出中的情况并非如此。 enter image description here

有什么想法吗?

最佳答案

您可以查看我的以下博客文章,了解在 Web API 中进行压缩的一种方法。 http://blogs.msdn.com/b/kiranchalla/archive/2012/09/04/handling-compression-accept-encoding-sample.aspx

如果您想使用 IIS 进行压缩,请查看以下帖子: https://stackoverflow.com/a/17331627/1184056

关于asp.net - 配置IIS动态压缩Json,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/25886628/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com