“runAllManagedModulesForAllRequests”时的静态压缩设置为“true”;
我们在 ASP.NET 旧版 Web 应用程序之前更新了一次以使用 .NET Framework 4.0。那里没有任何问题。上一次冲刺,我们实现了新模块来重写 SEO 优化的 URL。但是,因为我们想要使用没有任何文件和扩展名的 URL(例如,而不是 http://server/ Some-Nice-URL/file.aspx 仅 http://server/Some-Nice-URL/ )我们被迫设置将“runAllManagedModulesForAllRequests”设置为“true”,因为如果没有此设置,ASP.NET 会话将不可用。
现在我们遇到了静态压缩和 GZIP 的问题。经过几次回发后,我们“丢失”了 CSS 和/或 JavaScript。如果我直接访问 CSS 或 Javascript 文件,有时会收到浏览器消息“内容编码错误”,有时文件传输正确。在Fiddler中,CSS或Javascript文件的长度有时不正确,但在HTTP压缩中显示GZIP编码和“响应已编码,我需要在检查前解码”。单击“GZip 标头中的幻数不正确”后。如果我们将“runAllManagedModulesForAllRequests”或“doStaticCompression”设置为“false”,则静态压缩和“丢失”CSS 和/或 Javascript 文件不会出现任何问题。
有什么想法吗?
We updated a time before our ASP.NET legacy web application to use .NET Framework 4.0. No any problems there. Last sprint, we implemented new module to rewrite SEO optimized URLs. But, because we want use URLs without any file and extension (for example instead of http://server/Some-Nice-URL/file.aspx only http://server/Some-Nice-URL/) we were forced to set 'runAllManagedModulesForAllRequests' to 'true', because without this was the ASP.NET session not available.
We have now the problem with static compression and GZIP. After couple of postbacks we "lost" the CSS and/or Javascripts. If I access the CSS or Javascript file directly, I get sometimes browser message 'Content Encoding Error', sometimes is the file delivered correctly. In Fiddler is length of CSS or Javascript files sometime incorrect but the in HTTPCompression is shown GZIP Encoding and "Response is encoded and my need to be decoded before inspection". After click "The magic number in GZip header is not correct". If we set 'runAllManagedModulesForAllRequests' or 'doStaticCompression' to 'false', no any problems with static compression and "lost" CSS and/or Javascript files.
Any idea?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
发生这种情况是因为在某些时候您在标头上设置了文件的内容长度,之后 gzip 尝试更改该长度但失败,因为您没有将 iis 设置为能够更改标头,并且您发送了 gzip文件大小错误,这会产生问题。
要解决此问题,请找到您设置此内容长度的点并将其删除,或者在设置后更改 iss 以接受标头更改。
看看这个类似的答案:
https://stackoverflow.com/a/3210574/159270
和这个:
在负载平衡服务器上加载时,ASP.NET 网站有时会冻结和/或在页面顶部显示奇怪的文本
This is happens because in some point you set the content length of your files on header, after that the gzip try to change that length but fail because you do not have set up the iis to be able to change the headers, and you send gzip file with wrong size and this creates problems.
To solve this, find the point that you set this content length and remove it, or change the iss to accept header change after you have set it.
Look and this similar answer:
https://stackoverflow.com/a/3210574/159270
and this :
ASP.NET site sometimes freezing up and/or showing odd text at top of the page while loading, on load balanced servers