我们有一个“ .asmx” Web服务,该服务被称为VSTO外接程序项目。安装加载项后,某些客户端会收到错误消息,例如“请求失败,响应为空”。对于其他一些客户,它的工作正常。可能是什么原因?
注意:
代码示例:
try {
System.Net.ServicePointManager.SecurityProtocol = System.Net.SecurityProtocolType.Tls12;
APMService svc = new APMService();
System.Net.ServicePointManager.DefaultConnectionLimit = 40;
LoginResponseStatus lresponse = svc.LoginUser("UserName", "Password", "LicenceKey");
txtBox.Text = lresponse.status.ToString();
}
catch (Exception ex)
{
txtBox.Text = ex.Message + "\n" + ex.StackTrace + "\n" + ex.InnerException;
}
错误响应:
System.Net.WebException: The request failed with an empty response.
at System.Web.Services.Protocols.SoapHttpClientProtocol.ReadResponse(SoapClientMessage message, WebResponse response, Stream responseStream, Boolean asyncCall)
at System.Web.Services.Protocols.SoapHttpClientProtocol.Invoke(String methodName, Object[] parameters)
at Service.MethodName(String loggedInUserEmail)
at ServiceCallerLocatin.MethodName(String LoggedInUserEmail)
Stack trace:
at System.Web.Services.Protocols.SoapHttpClientProtocol.ReadResponse(SoapClientMessage message, WebResponse response, Stream responseStream, Boolean asyncCall)
at System.Web.Services.Protocols.SoapHttpClientProtocol.Invoke(String methodName, Object[] parameters)