502错误的网关-来自C#的POST,但在提琴手中工作正常 [英] 502 bad gateway - POST from C# but works fine in fiddler
问题描述
VS中的c#代码,我尝试使用WebClient,HttpClient或HttpWebRequest,将帖子发送到url,但始终会收到502错误的网关错误,但是,帖子工作正常,在提琴手或邮递员中返回200OK
c# code in VS, I tried either WebClient, HttpClient OR HttpWebRequest, sending a post to an url, but always get 502 bad gateway error, however, the post works fine , return 200OK in fiddler or postman
顺便说一句,相同的代码可以在另一台机器上正常工作.猜猜我的机器设置有问题,我可以检查为什么吗?
BTW, same code works fine on another machine. guess sth wrong with my machine setting, anything I can check why?
推荐答案
好的,我自己回答,原来是代码问题,但是我不确定为什么,我必须设置client.DefaultRequestHeaders.ExpectContinue =错误;
all right, I am answering it myself, turns out it is a code issue but I am not sure why, I have to set client.DefaultRequestHeaders.ExpectContinue = false;
这篇关于502错误的网关-来自C#的POST,但在提琴手中工作正常的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!