IIS 7.5 ASP.NET

编程入门 行业动态 更新时间:2024-10-27 16:24:02
本文介绍了IIS 7.5 ASP.NET-4 Gzip压缩的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧! 问题描述

我似乎无法为我的ASP.NET 4应用程序启用GZIP压缩。只有javascript文件似乎被压缩。

I just can't seem to get GZIP compression enabled for my ASP.NET 4 application. Only javascript files seem to get compressed. The page, css and others dont get compressed.

未压缩的CSS文件的响应标题为:

The response header of a not compressed CSS file is:

Content-Type text/css Last-Modified Mon, 09 Aug 2010 20:10:34 GMT Accept-Ranges bytes Etag "5d71bdecfe37cb1:0" Server Microsoft-IIS/7.5 Date Sat, 28 Aug 2010 14:33:56 GMT Content-Length 3364

对于被压缩的Javascript文件(scriptresource.axd):

And for a Javascript file that gets compressed (scriptresource.axd):

Cache-Control public Content-Type application/x-javascript Content-Encoding gzip Expires Sun, 28 Aug 2011 14:33:50 GMT Last-Modified Sat, 28 Aug 2010 14:33:50 GMT Server Microsoft-IIS/7.5 Date Sat, 28 Aug 2010 14:33:56 GMT Content-Length 478

在applicationHost.config中:

In applicationHost.config:

<httpCompression sendCacheHeaders="false" directory="%SystemDrive%\inetpub\temp\IIS Temporary Compressed Files" noCompressionForRange="true"> <scheme name="gzip" dll="%Windir%\system32\inetsrv\gzip.dll" /> <staticTypes> </staticTypes> <dynamicTypes> </dynamicTypes> </httpCompression>

在应用程序web.config中:

And in the app web.config:

<urlCompression doStaticCompression="true" doDynamicCompression="true" dynamicCompressionBeforeCache="true" /> <httpCompression noCompressionForRange="false" noCompressionForHttp10="false" noCompressionForProxies="false" > <dynamicTypes> <add mimeType="text/css" enabled="true" /> </dynamicTypes> <staticTypes> <add mimeType="text/css" enabled="true" /> </staticTypes> </httpCompression>

任何人都可以告诉我我缺少什么设置?

Can anybody tell me what setting I am missing?

推荐答案

我发现了什么问题...在打开或关闭Windows功能 - > WWW - >性能特性,动态压缩未启用(很愚蠢)。

I found out what the problem was... In Turn Windows features on or off -> WWW -> Performance features, the static & dynamic compression was not enabled (pretty stupid).

Javascript被压缩的原因可能是因为ScriptResource.axd实现了自定义gzip编码。

The reason the Javascript was compressed is probably because ScriptResource.axd implements a custom gzip encoding.

更多推荐

IIS 7.5 ASP.NET

本文发布于:2023-11-12 04:52:14,感谢您对本站的认可!
本文链接:https://www.elefans.com/category/jswz/34/1580556.html
版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系,我们将在24小时内删除。
本文标签:IIS   NET   ASP

发布评论

评论列表 (有 0 条评论)
草根站长

>www.elefans.com

编程频道|电子爱好者 - 技术资讯及电子产品介绍!