【发布时间】:2017-07-13 12:38:27
【问题描述】:
我总共有 12 个连续请求,在第 6 个 请求中我收到了这个错误。 The request was aborted: The operation has timed out.(预计时间为 18 秒)。并且在 6th 请求之后,所有剩余的请求又很快了。为什么第 6 个请求与所有其他请求相比太慢了?
这是我的代码:
public bool CreateFolder(string _strDirectory)
{
bool result = true;
System.Net.HttpWebRequest Request;
CredentialCache MyCredentialCache;
MyCredentialCache = new System.Net.CredentialCache();
MyCredentialCache.Add(new System.Uri(_strDirectory), "NTLM", new System.Net.NetworkCredential(UserName, Password));
Request = (System.Net.HttpWebRequest)HttpWebRequest.Create(_strDirectory);
Request.Credentials = MyCredentialCache;
Request.Method = "MKCOL";
Request.Proxy = null;
ServicePointManager.Expect100Continue = false;
try
{
using (var response = (System.Net.HttpWebResponse)Request.GetResponse())
{
}
}
catch (Exception)
{
throw;
}
Request.Abort();
return result;
}
我还在我的 Web.config 中添加了这行代码:
<system.net>
<connectionManagement>
<clear/>
<add address="*" maxconnection="1000000" />
</connectionManagement>
有什么想法吗?非常感谢!
【问题讨论】:
标签: c# asp.net iis fileserver