我總共有連續請求和第6請求我得到這個錯誤。 The request was aborted: The operation has timed out.
(預計時間爲18秒)。並且在請求所有剩餘的請求之後,再次快速地請求第6個。爲什麼第6次請求比其他請求慢?請求已中止:操作已超時。在HttpWebResponse.Request.GetResponse()
這是我的代碼:
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>
任何想法?非常感謝你!
基於我的異常日誌,錯誤仍然發生'請求被中止:操作超時.'和響應時間仍然是18秒。 – Joseph
這樣做的伎倆,我編輯50000 500,所以超時將是5毫秒不50秒作爲最大。 – Joseph
@JAlcantara很高興我能幫到你。來自以色列的和平與愛。 –