Last post Jul 17, 2020 01:34 AM by vksinghbhu
Jul 17, 2020 01:34 AM|vksinghbhu|LINK
Environment : .NET Framework 4.6.1, Visual Studio 2019, Windows Server 2012 R2
I have developed a C# code to call a web service. During 24x7 test this function is being called by
10 threads simultaneously. Unfortunately I am getting error "The operation has timed out" after 20 to 30 successful calls.
Please suggest how this issue can be resolved.
Thanks in advance.
public string RestCall(string url, string strMsgData)
HttpWebRequest request = (HttpWebRequest)WebRequest.Create(url);
string userSessionID = "EdisphereSessionID";
request.ConnectionGroupName = "userSessionID";
request.ServicePoint.MaxIdleTime = 5 * 1000;
request.ServicePoint.ConnectionLimit = 1000;
request.Timeout = 300000;
request.Method = "POST";
request.ContentType = "xml; charset=utf-8";
using (Stream reqstream = request.GetRequestStream())
using (StreamWriter writer = new StreamWriter(reqstream))
using (WebResponse response = request.GetResponse())
using (StreamReader reader = new StreamReader(response.GetResponseStream()))
strRecv = reader.ReadToEnd();