简体   繁体   English

调用Web服务返回远程服务器返回错误:(502)错误的网关

[英]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.

相关问题 远程服务器返回错误:(502) Bad Gateway。 在MVC中 - The remote server returned an error: (502) Bad Gateway. in MVC 远程服务器返回了意外的响应:(502)Azure WCF中的错误网关 - The remote server returned an unexpected response: (502) Bad Gateway in Azure WCF 调用服务引用会导致“远程服务器返回错误:(400)错误请求”错误 - Calling a Service reference results in a “The remote server returned an error: (400) Bad Request” error wcf服务远程服务器返回错误(400)错误的请求 - wcf service the remote server returned an error (400) bad request 远程服务器返回错误:(500)内部服务器错误Web服务 - The remote server returned an error: (500) Internal Server Error Web service 上传大文件 - Azure App Service 上的 502 bad gateway 错误 - Upload large file - 502 bad gateway error on Azure App Service 502 错误:使用 IronPDF 的 Azure 应用服务上的网关错误 - 502 Error: Bad Gateway on Azure App Service with IronPDF 远程服务器返回错误:(400)错误请求? - The remote server returned an error: (400) Bad Request? 远程服务器返回错误(400)错误的请求 - the remote server returned an error (400) bad request ALM Rest API:site-session返回“远程服务器返回错误:(400)错误的请求。” - ALM Rest API : site-session returns 'The remote server returned an error: (400) Bad Request.'
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM