I have total of 12 continuous request and in the 6th request I got this error. The request was aborted: The operation has timed out.
(estimated time is 18 seconds). And After the 6th request all of the remaining request is fast again. Why the 6th request is too slow compare to all other request?
This is my code:
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;
}
I also added to my Web.config this line of codes:
<system.net>
<connectionManagement>
<clear/>
<add address="*" maxconnection="1000000" />
</connectionManagement>
Any idea? Thank you very much!
Try adding:
<system.web>
<httpRuntime executionTimeout="90000" maxRequestLength="1048576" />
....
Also,
Add these:
request.KeepAlive = false;
request.Timeout = 50000;
request.ServicePoint.ConnectionLeaseTimeout = 50000;
request.ServicePoint.MaxIdleTime = 50000;