远程服务器返回错误:(502)Bad Gateway [英] The remote server returned an error: (502) Bad Gateway

查看:279
本文介绍了远程服务器返回错误:(502)Bad Gateway的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

由于某种原因,我无法从服务器读取响应,而是给出错误远程服务器返回错误:(502)Bad Gateway但是如果我检查服务器日志 - 它发送响应,任何人都可以告诉我,如果我因为无法收到回复而遗漏了某些内容



For some reason, I am not able to read the response from the server instead it give the error " The remote server returned an error: (502) Bad Gateway" however if I check the server logs - it sends the response, can anyone let me know if I am missing something for not able to receive the response

try
{
  DOMFlightAvailabilityPortTypeClient obj = new DOMFlightAvailabilityPortTypeClient();
  string req = "<Request>"
  + "<Origin>BOM</Origin>"
  + "<Destination>DEL</Destination>"
  + "<DepartDate>2014-11-20</DepartDate>"
  + "<ReturnDate>2014-12-21</ReturnDate>"
  + "<AdultPax>1</AdultPax>"
  + "<ChildPax>0</ChildPax>"
  + "<InfantPax>0</InfantPax>"
  + "<Currency>INR</Currency>"
  + "<Clientid>12345</Clientid>"
  + "<Clientpassword>12345</Clientpassword>"
  + "<Clienttype>12345</Clienttype>"
  + "<Preferredclass>E</Preferredclass>"
  + "<mode>ONE</mode>"
  + "<PreferredAirline>AI,G8,IC,6E,9W,S2,IT,9H,I7,SG</PreferredAirline>"
  + "</Request>";

  string str = obj.getAvailability(req);
  XmlDocument doc = new XmlDocument();
  doc.LoadXml(str);
  DataSet ds = new DataSet();
  ds.ReadXml(new XmlTextReader(new StringReader(str)));
  GridView1.DataSource = ds.Tables[0];
  GridView1.DataBind();
}
catch (WebException ex)
{
  if (ex.Status == WebExceptionStatus.ProtocolError)
  {
     WebResponse resp = ex.Response;
     using (StreamReader sr = new StreamReader(resp.GetResponseStream()))
     {
         Response.Write(sr.ReadToEnd());
     }
  }
}

推荐答案

错误502Bad Gateway是内部服务器错误并且通常与您的代码无关,但与Web服务器和数据库系统之间的内部通信或类似。



与托管人员的Web服务器通信:他们也许可以对它进行排序。
Error 502 "Bad Gateway" is an internal server error and generally has nothing to do with your code, but with internal communications between the web server and the database system or similar.

Talk to your web server hosting people: they may be able to sort it.


这篇关于远程服务器返回错误:(502)Bad Gateway的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆