C# &引用;请求失败,响应为空";来自ASMXWeb服务

C# &引用;请求失败,响应为空";来自ASMXWeb服务,c#,wpf,web-services,soap,azure-app-service-envrmnt,C#,Wpf,Web Services,Soap,Azure App Service Envrmnt,我们有一个“.asmx”web服务,它被引用到VSTO插件项目中。在安装外接程序后,一些客户端收到错误消息“请求失败,响应为空”。对于其他一些客户来说,其工作正常。原因可能是什么 注: 我们添加了web服务作为web引用 对于一些客户来说,它的工作正如预期的那样 我们将该服务作为Azure应用程序服务托管 代码示例: try { System.Net.ServicePointManager.SecurityProtocol = System.Net.SecurityProto

我们有一个“.asmx”web服务,它被引用到VSTO插件项目中。在安装外接程序后,一些客户端收到错误消息“请求失败,响应为空”。对于其他一些客户来说,其工作正常。原因可能是什么

注:

  • 我们添加了web服务作为web引用
  • 对于一些客户来说,它的工作正如预期的那样
  • 我们将该服务作为Azure应用程序服务托管
  • 代码示例:

     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)
    

    当您调试web服务(服务器端部分)时,它返回了什么?它将返回对象,其中包含特定于该用户的一些详细信息。如果身份验证成功,它将向该对象返回相应的错误代码。如果它适用于某些对象,而不适用于其他对象,则很难说问题出在哪里,因为可能有很多东西。您在web服务中有调试日志记录吗?如果不是的话,我建议添加一些(Serilog很容易恢复),我们已经在服务器端代码中添加了日志,但在失败的情况下,没有任何日志发生。实际上,该方法是以日志自启动的。如果该方法做的第一件事是记录日志,但没有看到日志条目,则不会调用它。可能是因为使用了不正确的参数类型,所以没有进行调用。您需要知道是什么数据导致了故障,以便能够重现故障。当你能做到这一点时,你就可以尝试并遵循导致失败的逻辑。