I have windows service application which should be communicating with other server. Problem is that it works for a while after I restart the windows service but after some time it stops working (response.StatusCode = 0).
var client = new RestClient("https://..../auth/token")
{
Proxy = new WebProxy(host, port)
};
var request = new RestRequest(Method.POST);
request.AddHeader("Content-Type", "application/json");
var content = new
{
sp = sp,
officeId = officeId
};
request.AddJsonBody(_javaScriptSerializer.Serialize(content));
var response = client.Execute(request);
Windows service is implemented in .NET Framework 4.5.2. Security protocol for TLS 1.2 is enabled:
System.Net.ServicePointManager.SecurityProtocol |= SecurityProtocolType.Tls12;
I created dummy windows service which contains only this 1 call to the other server and I can see that this dummy windows service is working fine without any issues.
Do you have please any idea on what should I focus or what could be the root cause of it?