我有 Windows 服务应用程序,它应该与其他服务器通信。问题是它在我重新启动 Windows 服务后工作了一段时间,但一段时间后它停止工作(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 服务在 .NET Framework 4.5.2 中实现。 TLS 1.2 的安全协议已启用:
System.Net.ServicePointManager.SecurityProtocol |= SecurityProtocolType.Tls12;
我创建了虚拟 Windows 服务,其中只包含对另一台服务器的 1 次调用,我可以看到这个虚拟 Windows 服务运行良好,没有任何问题。
请问您对我应该关注什么或导致它的根本原因有什么想法吗?