异常:请求因HTTP状态400失败:Bad Request。
2007-07-18 17:57
561 查看
基本情况是这样,一个ASP.NET应用程序,后台调用WebService,装在自己的机器上一切都正常。上传到一个服务器以后,就会报出Title中描述的异常。最后一条堆栈会跟踪到SoapHttpClientProtocol.ReadResponse()这个函数。
上网搜了一下,大家没有什么明确的方法,但是都确认应该是Web.Config中的问题,最大的可能性就是WebService的地址有问题。
我的Web.Config中有以下设置:
<appSettings>
<add key="localhost.mywebservice" value="http://localhost/Test/TestWebService.asmx"/>
</appSettings>
于是我远程连接到目标服务器,然后直接用浏览器打开http://localhost/Test/TestWebService.asmx,果不然,浏览器提示我输入验证信息,因为那个服务器要访问外网必须通过代理服务器,访问localhost也需要。
把localhost改成实际内网的IP地址,问题也就解决了。
大家遇到类似的问题,尤其是以前好用,换了服务器就不好用的情况,也来检查一下WebService的地址吧~~~
上网搜了一下,大家没有什么明确的方法,但是都确认应该是Web.Config中的问题,最大的可能性就是WebService的地址有问题。
我的Web.Config中有以下设置:
<appSettings>
<add key="localhost.mywebservice" value="http://localhost/Test/TestWebService.asmx"/>
</appSettings>
于是我远程连接到目标服务器,然后直接用浏览器打开http://localhost/Test/TestWebService.asmx,果不然,浏览器提示我输入验证信息,因为那个服务器要访问外网必须通过代理服务器,访问localhost也需要。
把localhost改成实际内网的IP地址,问题也就解决了。
大家遇到类似的问题,尤其是以前好用,换了服务器就不好用的情况,也来检查一下WebService的地址吧~~~
相关文章推荐
- asp.net Web Service请求因 HTTP 状态 400 失败: Bad Request的原因
- SQL 2005 Report Server 请求因 HTTP 状态 400 失败: Bad Request 处理方法 的解决方法
- SQL 2005 Report Server 请求因 HTTP 状态 400 失败: Bad Request 处理方法
- 请求因 HTTP 状态 400 失败: Bad Request
- [WebService]请求因 HTTP 状态 400 失败: Bad Request。
- cookies过多导致的http400 Bad Request异常
- 分享失败 http/1.1 400 bad request 【sina android sdk】
- 异常:"System.Net.WebException: 请求因 HTTP 状态 401 失败:Unauthorized。"
- HTTP 400 错误 - 请求无效 (Bad request)
- 异常:"System.Net.WebException: 请求因 HTTP 状态 401 失败:Unauthorized。"
- Web service request SetParameters to Report Server http://host/reportserver failed. Error: 请求因 HTTP 状态 401 失败: Unauthorized
- Http的Get/Post请求带有特殊字符,400 Bad Request解决方案
- Http的Get/Post请求带有特殊字符,400 Bad Request解决方案
- 错误:bad request 400(建立socket http get请求)-linux
- Spring MVC HTTP 400 错误 - 请求无效 (Bad request)
- HTTP 400 错误 - 请求无效 (Bad request)
- Web service request SetParameters to Report Server http://host/reportserver failed. Error: 请求因 HTTP 状态 401 失败: Unauthorized
- HTTP 400 错误 - 请求无效 (Bad request)
- Http的Get/Post请求带有特殊字符,400 Bad Request解决方案
- Web service request SetParameters to Report Server http://host/reportserver failed. Error: 请求因 HTTP 状态 401 失败: Unauthorized