简体   繁体   English

如何在ASP.NET MVC 5中调用SOAP Web服务时修复502 Bad Gateway错误?

[英]How to fix 502 Bad Gateway error when calling SOAP webservice in ASP.NET MVC 5?

I am having an issue with an ASP.NET MVC 5 application calling a SOAP web service. 我遇到一个ASP.NET MVC 5应用程序调用SOAP Web服务的问题。 I am getting 502 bad gateway error when POSTing to the webservice. 在发布到webservice时,我收到502错误的网关错误。

However, when I take the same payload and put it into SOAPUI and POST it to the web service it works fine. 但是,当我使用相同的有效负载并将其放入SOAPUI并将其发布到Web服务时,它可以正常工作。 We have a ASP.NET Webforms application that calls the same web service without any issue. 我们有一个ASP.NET Webforms应用程序,可以毫无问题地调用相同的Web服务。

Has anyone come across this before? 有没有人遇到过这个?

I have now resolved this. 我现在解决了这个问题。 I captured the traffic between SOAPUI and my app in fiddler. 我在fiddler中捕获了SOAPUI和我的app之间的流量。 The only real difference I found between the requests was that I found that my application was passing Expect: 100-Continue in the headers. 我在请求之间找到的唯一真正区别是我发现我的应用程序在标题中传递了Expect:100-Continue。

Adding this piece of code before the POST to the webservice fixed my issue: 在POST之前将这段代码添加到webservice修复了我的问题:

System.Net.ServicePointManager.Expect100Continue = false;

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 ASP.NET Core 2.0 ngrok 502 错误网关错误 - ASP.NET Core 2.0 ngrok 502 Bad Gateway Error ASP.Net 请求引发 502 Bad Gateway 或 TimeOut - ASP.Net request raises 502 Bad Gateway or TimeOut 上传大文件时 502 Bad Gateway nginx 和 ASP.NET Core 3.1 - 502 Bad Gateway nginx and ASP.NET Core 3.1 when upload big file 从 Azure 中托管的 Asp.net Core MVC Web App 获取“响应状态代码并不表示成功:502(坏网关)” - Getting "Response status code does not indicate success: 502 (Bad Gateway)" from Asp.net Core MVC Web App hosted in Azure 来自 .net C# 的 WebService 调用出现错误:(502) 网关错误 - WebService Call from .net C# getting error : (502) Bad Gateway 从另一个 locahost.Net Core API 调用 locahost.Net Core API 时出现错误网关(502)错误 - Bad Gateway (502) error while calling locahost .Net Core API from another locahost .Net Core API 如何在MVC ASP.NET中使用此WebService - How to use this WebService in MVC ASP.NET 如何在ASP.NET Core中发布JSON有效负载时解决“错误请求(400)”错误? - How to fix 'Bad Request (400)' error when POSTing JSON payload in ASP.NET Core? 错误连接android和asp.net soap webservice - Error connection android and asp.net soap webservice ASP.NET MVC Web请求仅在部署到IIS时才说代理错误502 - asp.net mvc web request says proxy error 502 only when deployed to iis
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM