【问题标题】:(500) Internal Server Error - When sending web request using api(500) 内部服务器错误 - 使用 api 发送 Web 请求时
【发布时间】:2013-09-13 20:28:24
【问题描述】:

我正在发送网络请求并收到内部服务器错误:500。

我如何确定是哪一方造成了这个错误? 我这边还是外部api那边?

我没有在我的事件查看器中看到日志。

这是我的代码:

var request = WebRequest.Create("http://saas.appoxee.com/api/") as HttpWebRequest;
request.Method = WebRequestMethods.Http.Post;
request.ContentType = "application/json";

// Add the content to the request
string postDataJsonFormat = CreateExampleTagRequest();
byte[] byteArray = Encoding.UTF8.GetBytes(postDataJsonFormat);
request.ContentLength = byteArray.Length;

Stream dataStream = request.GetRequestStream();
dataStream.Write(byteArray, 0, byteArray.Length);
dataStream.Close();

// Getting and processing the response
var response = request.GetResponse() as HttpWebResponse;

【问题讨论】:

    标签: c# .net api httpwebrequest


    【解决方案1】:

    500.0 – 内部服务器错误”是一个 IIS 错误代码,表示 Web 服务不可用。这意味着错误在于 API,而不是您的客户端。

    服务器代码摘要:

    1xx - 信息性

    2xx - 成功

    3xx - 重定向

    4xx - 客户端错误

    5xx - 服务器错误

    查看完整代码列表:http://support.microsoft.com/kb/943891 关于 500 代码:http://support.microsoft.com/kb/942031

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 2022-11-01
      • 1970-01-01
      • 1970-01-01
      • 2015-11-08
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2015-09-20
      相关资源
      最近更新 更多