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