"请求的空响应&QUOT失败;调用Web服务时 [英] "The request failed with an empty response" when calling a web service

查看:2879
本文介绍了"请求的空响应&QUOT失败;调用Web服务时的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

在呼吁从一个aspx页面的服务器托管的Web服务正在错误,如请求空响应失败。

While calling a webservice hosted in a server from an aspx page am getting the error like "The request failed with an empty response".

代码在我的网页

try {
    HttpWebRequest request1 = (HttpWebRequest)WebRequest.Create("https://login.erp.com/rodeprovisioning/provisioning.asmx");
    request1.Accept = "text/xml";
    request1.Method = "POST";
    WebProxy proxyObject = new System.Net.WebProxy("http://10.0.0.1:8080/", true);
    request1.Proxy.Credentials = CredentialCache.DefaultCredentials;
    string sReturnValue = null;
    if (string.IsNullOrEmpty(Session["Test"])) {
        sReturnValue = callservice();
        if (sReturnValue == "Success") {
            ErrorLabel.Text = sReturnValue;
            Session["Test"] = "True";
        } else {
            ErrorLabel.Text = sReturnValue;
        }
    }

} catch (Exception ex) {

}

和在web.config中

and in web.config

<system.net>
    <authenticationModules>
      <add type = "System.Net.DigestClient" />
      <add type = "System.Net.NegotiateClient" />
      <add type = "System.Net.KerberosClient" />
      <add type = "System.Net.NtlmClient" />
      <add type = "System.Net.BasicClient" />
    </authenticationModules>
    <connectionManagement>
      <add address = "*" maxconnection = "2" />
    </connectionManagement>
    <defaultProxy>
      <proxy usesystemdefault="True"   bypassonlocal = "True"   />
    </defaultProxy>
    <webRequestModules>
      <add prefix = "http"   type = "System.Net.HttpRequestCreator"        />
      <add prefix = "https"  type = "System.Net.HttpRequestCreator"        />
      <add prefix = "file"   type = "System.Net.FileWebRequestCreator"         />
    </webRequestModules>
  </system.net>



它是一个防火墙problem.Any建议?

Is it a firewall problem.Any Suggestion?

推荐答案

我知道这是一个老问题,但我们有同样的异常在我们的集成环境之一发生:

I know this is an old question, but we had the same exception happening in one of our integration environments:

System.Net.WebException: The request failed with an empty response

问题是,当我们升级了服务器硬件,我们也交换所有的端点使用HTTPS是。被调用终端的代码不能升级,因此该公司仍使用普通的HTTP。显然,这是你得到的异常,当您试图调用一个HTTPS服务为HTTP。希望这可以帮助别人的路线。

The issue was that when we upgraded the server hardware, we also switched all of our endpoints to be using HTTPS. The code that was calling the endpoints was not upgraded, so it was still using regular HTTP. Apparently this is the exception you get when you try to call an HTTPS service as HTTP. Hope this helps someone down the line.

这篇关于&QUOT;请求的空响应&QUOT失败;调用Web服务时的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
相关文章
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆