访问Web服务时出现Http 502 Bad Gateway错误 [英] Http 502 Bad Gateway error when accessing a web service

查看:85
本文介绍了访问Web服务时出现Http 502 Bad Gateway错误的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个asp.net 4.0网站,正在使用一些外部Web服务来检索显示的某些数据.

I have a asp.net 4.0 web site and I'm using some external web services to retrieve some data that I display.

我已经使用wsdl工具为这些Web服务创建了代理.我正在设置一个URL,并在Web服务上设置了PreAuthenticate = true和Credentials = new System.Net.NetworkCredentials(用户名,密码).

I have created proxies for those web services using the wsdl tool. I'm setting an url and I'm setting PreAuthenticate = true and Credentials = new System.Net.NetworkCredentials(userName, password) on the web service.

当我尝试在远程服务器上使用Web服务方法时,出现异常.System.Net.WebException是.请求失败,HTTP状态为502:代理错误(没有可用的数据记录.)."

I get an exception when I try to use the web service method on a remote server. The System.Net.WebException is. "The request failed with HTTP status 502: Proxy Error ( No data record is available. )."

仅当我将VS 2010设置为使用本地IIS Web服务器(IIS 7.5)时,才会发生此异常.当我将VS 2010设置为使用VS Development Server时,使用相同的Web服务方法完全没有问题.我已在IE中打开和关闭代理设置,以查看是否是这种情况,但没有区别.

This exception only occurs when I have set my VS 2010 to use my local IIS Web Server (IIS 7.5). When I set VS 2010 to use the VS Development Server there is no trouble at all using the same web service method. I have turned on and off proxy settings in IE to see if that was the case, but no difference there.

在这里我真的需要一些帮助来解决此问题.

I could really need some help here to solve this issue.

谢谢!

推荐答案

似乎问题出在进程模型"设置(在IIS 7.5中)!身份必须设置为网络服务,而不是默认设置ApplicationPoolIdentity.

Seems the problem was the Process Model setting (in IIS 7.5)! The Identity had to be set to Network Service and not ApplicationPoolIdentity which is the default setting.

这篇关于访问Web服务时出现Http 502 Bad Gateway错误的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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