(500) 内部服务器错误 - 使用 api 发送 Web 请求时

(500) 内部服务器错误 - 使用 api 发送 Web 请求时

问题描述:

我正在发送 Web 请求并收到内部服务器错误:500.

I am sending a web request and getting internal server error : 500.

我如何确定哪一方对出现此错误负责?我这边还是外部api那边?

How can i be sure what side is responsible for getting this error? My side or the external api side?

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

I didn`t see logs in my event viewer.

这是我的代码:

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;

"500.0 – Internal Server Error"是 IIS 错误代码,表示 Web 服务不可用.这意味着错误在于 API,而不是您的客户端.

"500.0 – Internal Server Error" is an IIS Error code meaning that the web service is unavailable. This means the error is with the API, not your client.

服务器代码摘要:

1xx - 信息

2xx - 成功

3xx - 重定向

4xx - 客户端错误

4xx - Client error

5xx - 服务器错误

5xx - Server error

有关代码的完整列表,请查看此处:http://support.microsoft.com/kb/943891以及关于 500 代码的具体内容:http://support.microsoft.com/kb/942031

For a full list of codes look here: http://support.microsoft.com/kb/943891 and about the 500 code specifically: http://support.microsoft.com/kb/942031