在Azure云服务中,我们具有启动任务以在服务器级别启用httpcompression 。
%appcmd% set config -section:system.webServer/serverRuntime /frequentHitThreshold:"1"
%appcmd% set config -section:system.webServer/urlCompression /doDynamicCompression:"True"
%appcmd% set config -section:system.webServer/httpCompression /-"dynamicTypes.[mimeType='text/css']"
%appcmd% set config -section:system.webServer/httpCompression /+"dynamicTypes.[mimeType='text/css',enabled='True']"
然后在web.config中,我们执行此操作以在站点级别启用httpcompression:
<urlCompression doDynamicCompression="true" dynamicCompressionBeforeCache="true" doStaticCompression="true" />
这是行不通的。在IIS管理器中,我可以看到站点级别启用了httpcompression,但是响应未压缩。
但是,如果我在web.config中将所有设置都设置为false,然后在IIS管理器中手动启用设置,那么它将起作用!
有什么想法会发生这种情况吗?这需要自动化,因此即使手动设置也可以,但对我来说这不是一个解决方案。
谢谢!!
忘了回应我的发现-原来我需要删除web.config中的httpCompression和urlCompression设置,然后一切正常。感觉像一个IIS错误。
本文收集自互联网,转载请注明来源。
如有侵权,请联系[email protected] 删除。
我来说两句