【发布时间】:2011-01-21 19:25:12
【问题描述】:
我使用此代码 sn-p 来验证 URL 中指定的文件是否存在,并每隔几秒钟为每个用户尝试一次。有时(主要是当有大量用户使用该站点时)代码不起作用。
[WebMethod()]
public static string GetStatus(string URL)
{
bool completed = false;
HttpWebRequest request = (HttpWebRequest)WebRequest.Create(URL);
using (HttpWebResponse response = (HttpWebResponse)request.GetResponse())
{
try
{
if (response.StatusCode == HttpStatusCode.OK)
{
completed = true;
}
}
catch (Exception)
{
//Just don't do anything. Retry after few seconds
}
}
return completed.ToString();
}
当我查看 Windows 事件日志时,有几个错误:
Unable to read data from the transport connection. An existing connection was forcibly closed
The Operation has timed out
The remote host closed the connection. The error code is 0x800703E3
当我重新启动 IIS 时,一切正常,直到下次发生这种情况。
【问题讨论】:
标签: c# asp.net iis exception scalability