调用Web服务返回远程服务器返回错误:(502)Bad Gateway

时间:2016-07-19 11:18:31

标签: c# .net

我正在尝试使用WSDL代理在C#中调用Web服务,Web服务需要传递凭据

PartsInquiryServiceHttpService client = new PartsInquiryServiceHttpService();
        client.Url = "Url";
        client.Credentials = new NetworkCredential("user Name", "password");

在此行中抛出异常

client.getMultiplePartsInquiry(enquiry);

未处理的类型' System.Net.WebException'发生在System.dll中的附加信息:远程服务器返回错误:(502)Bad Gateway

请帮忙

1 个答案:

答案 0 :(得分:0)

问题出在Web.config中。添加了代理标记,并且Web服务请求失败,因为未包含代理凭据。只需删除代理部分即可解决问题。

相关问题