在负载平衡服务器上加载时,ASP.NET 站点有时会卡住和/或在页面顶部显示奇怪的文本

标签 asp.net iis performance freeze

我有多个服务器(开发服务器、2 个测试服务器、2 个产品服务器)运行相同的 asp.net 站点。

测试和生产服务器处于负载平衡对中(prod1 与 prod2,test1 与 test2)。

测试服务器对在大约十分之一的页面加载期间表现出某种( super )减速或卡住。有时,页面的最顶部会出现一行文本,如下所示:

00 OK Date: Thu, 01 Apr 2010 01:50:09 GMT Server: Microsoft-IIS/6.0 X-Powered_By: ASP.NET X-AspNet-Version:2.0.50727 Cache-Control:private Content-Type:text/html; charset=ut

(开头和结尾被“切断”。)

有人见过这样的事情吗?知道这意味着什么或是什么原因造成的吗?

编辑: 单击某些内容时我也经常看到这种情况 - 它在黄页上显示为红色文本:

XML Parsing Error: not well-formed
Location: http://203.111.46.211/3DSS/CompanyCompliance.aspx?cid=14
Line Number 1, Column 24:2mMTehON9OUNKySVaJ3ROpN" />
                         -----------------------^

If I go back and click again, it works (I see the page I clicked on, not the above error message).

Update:

...And, instead of the page loading, I sometimes just get a white screen with text like this in black (looks a lot like the above text):

HTTP/1.1 302 Found Date: Wed, 21 Apr 2010 04:53:39 GMT Server: Microsoft-IIS/6.0 X-Powered-By: ASP.NET X-AspNet-Version: 2.0.50727 Location: /3DSS/EditSections.aspx?id=3&siteId=56&sectionId=46 Set-Cookie: .3DSS=A6CAC223D0F2517D77C7C68EEF069ABA85E9HFYV64F&FA4209E2621B8DCE38174AD699C9F0221D30D49E108CAB8A828408CF214549A949501DAFAF59F080375A50162361E4AA94E08874BF0945B2EF; path=/; HttpOnly Cache-Control: private Content-Type: text/html; charset=utf-8 Content-Length: 184

object moved here

Where "here" is a link that points to a URL just like the one I'm requesting, except with an extra folder in it, meaning something like:
http://123.1.2.3/MySite//MySite/Page.aspx?option=1

instead of:
http://123.1.2.3/MySite/Page.aspx?option=1

Update:

A colleague of mine found some info saying it might be because the test servers are running iis in 64 bit (64bit win 2003) (prod servers are 32 bit win 2003).

So we tried telling IIS to use 32 bit:
cscript %SYSTEMDRIVE%\inetpub\adminscripts\adsutil.vbs SET W3SVC/AppPools/Enable32bitAppOnWin64 1

%SYSTEMROOT%\Microsoft.NET\Framework\v2.0.50727\aspnet_regiis.exe -i

(from this MS support page)

But iis stopped working altogether (got "server unavailable" on a white page instead of web sites).

Reversing the above (see the link) didn't work at first either. The ASP.NET tab disappeared from our IIS web site properties and we had to mess around for an hour uninstalling (aspnet_regiis.exe -u) and reinstalling 32 bit ASP.NET and adding Default.aspx manually back into default documents.

We'll probably try again in a few days, if anyone has anything to add in the meantime, please do.

Update: This seems at odds with everything we've found out so far, but our testing shows that this problem happens only in Firefox, not IE or Chrome (!!??).

Update: The Solution
For anyone finding this later:
On Aristos's suggestion (see accepted answer) we searched the code for the HTTP Header "Content-Length". There was a page which set it, a page that pulls an image out of the DB for displaying a company logo (spits it straight to response, i.e.: instead of linking to say "log56.gif" you can link to "ThisImagePage.aspx?id=56" and it will serve the specified gif from the DB).
We commented out the line:

HttpContext.Current.Response.AddHeader("Content-Length", File.Length.ToString());

...并且成功了。如果有人发现其中的错误,请告诉我们,否则我猜这是某种 IIS 或负载均衡器配置问题,仅在手动设置二进制文件的内容长度时才会出现,并且仅在 Firefox 中出现(!?) .

最佳答案

MGOwen我将分享我遇到的类似问题的经验。

前段时间我遇到了类似的问题,页面运行良好,除了某些页面在使用 gZipped 压缩后出现问题并且无法正常工作,就像您的一样。

我发现问题是因为我在标题上设置了Content-Length,然后由于某种原因,当要压缩Content-Length时,没有改变/或被计算false,结果是与您类似的错误。

因此,请检查您是否在页面上以某种方式设置了内容长度,然后使用 gZip 过滤器。如果是,则删除程序中的内容长度设置。

总的来说,我说你的页面上的长度有问题,长度是Content-Length中的一个变量。

-并且在您的 header 中存在内容长度!-

更新
另一位认为我注意到,如果您的页面以 gZip 形式发送,那么您脑子里的内容在哪里?如果这是您页面的完整头部。

关于在负载平衡服务器上加载时,ASP.NET 站点有时会卡住和/或在页面顶部显示奇怪的文本,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/2582139/

相关文章:

IIS URL 重写 ~ 重写端口路径

c++ - 在 NTFS 上打开许多小文件太慢了

asp.net - 当页面上有多个按钮时,按钮样式在页面加载时有粗边框

asp.net网站到手机/平板电脑

asp.net - Visual SVN 指定带有新端口的 URL

.net - 连接字符串中的集成安全性

asp.net - .net 解决方案中具有多个项目的 Hangfire

c# - 结合 WCF 服务库和 WCF 服务应用程序

python - 比较python中的两个列表并打印输出

java - 进程关闭后可以打开自定义 hsperfdata_root/PID 吗?