[英]Calling web service returns The remote server returned an error: (502) Bad Gateway
I am trying to call a web service in C# using WSDL proxy, the web service requires credentials to be passed 我正在尝试使用WSDL代理在C#中调用Web服务,该Web服务需要传递凭据
PartsInquiryServiceHttpService client = new PartsInquiryServiceHttpService();
client.Url = "Url";
client.Credentials = new NetworkCredential("user Name", "password");
In this line an exception is thrown 在这一行中引发了异常
client.getMultiplePartsInquiry(enquiry);
unhandled exception of type 'System.Net.WebException' occurred in System.dll Additional information: The remote server returned an error: (502) Bad Gateway System.dll中发生类型为'System.Net.WebException'的未处理的异常其他信息:远程服务器返回错误:(502)错误的网关
Please help 请帮忙
The problem was in the Web.config. 问题出在Web.config中。 A proxy tag was added and the web service request fails because proxy credentials are not included. 添加了代理标记,并且Web服务请求失败,因为不包括代理凭据。 Simply removing the proxy section solved the problem. 只需删除代理部分即可解决该问题。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.