当'runAllManagedModulesForAllRequests'被设置为'true'时,静态压缩

时间:2022-10-27 21:47:31

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.

我们在ASP之前更新了一个时间。NET遗留web应用程序使用。NET Framework 4.0。没有任何问题。上一个sprint,我们实现了新的模块来重写SEO优化url。但是,因为我们希望使用没有任何文件和扩展的url(例如,而不是http://server/Some-Nice-URL/file)。只有aspx http://server/Some-Nice-URL/)我们*将“runAllManagedModulesForAllRequests”设置为“true”,因为没有这个就是ASP。网络会话。

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.

我们现在有了静态压缩和GZIP的问题。在两个回发之后,我们“丢失”了CSS和/或javascrip。如果我直接访问CSS或Javascript文件,我有时会得到浏览器消息“内容编码错误”,有时会得到正确的文件。在Fiddler中,CSS或Javascript文件的长度有时是不正确的,但在http压缩中显示GZIP编码和“响应是编码的,我需要在检查之前解码”。点击“GZip头中的神奇数字不正确”后。如果我们将“runallmanagedmodulesforallrequest”或“dostatic压缩”设置为“false”,那么静态压缩和“丢失”CSS和/或Javascript文件就不会有任何问题。

Any idea?

任何想法?

1 个解决方案

#1


3  

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.

这在某种程度上是因为你设置你的文件的内容长度头,后的gzip试图改变长度但失败,因为你没有设置iis能够改变标题,和你发送gzip文件错误的大小,这就产生了问题。

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.

要解决这个问题,找到设置内容长度并删除它的点,或者在设置完后更改iss以接受头修改。

Look and this similar answer: https://*.com/a/3210574/159270

看看这个相似的答案:https://*.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

这:ASP。在负载均衡的服务器上,NET站点有时会冻结和/或在页面顶部显示奇怪的文本

#1


3  

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.

这在某种程度上是因为你设置你的文件的内容长度头,后的gzip试图改变长度但失败,因为你没有设置iis能够改变标题,和你发送gzip文件错误的大小,这就产生了问题。

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.

要解决这个问题,找到设置内容长度并删除它的点,或者在设置完后更改iss以接受头修改。

Look and this similar answer: https://*.com/a/3210574/159270

看看这个相似的答案:https://*.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

这:ASP。在负载均衡的服务器上,NET站点有时会冻结和/或在页面顶部显示奇怪的文本