且构网

分享程序员开发的那些事...
且构网 - 分享程序员编程开发的那些事

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

更新时间:2023-09-20 23:52:52

500.0 - 内部服务器错误是一个IIS错误code的含义,网络服务不可用。这意味着错误的API,而不是你的客户。

服务器codeS摘要:

  

1XX - 信息

     

2XX - 成功

     

3XX - 重定向

     

4XX - 客户端错误

     

5XX - 服务器错误

有关的codeS的完整列表,看看这里: http://support.microsoft.com/ KB / 943891 大约在 500 code具体为: http://support.microsoft。 COM / KB / 942031

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

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.

This is my code:

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" is an IIS Error code meaning that the web service is unavailable. This means the error is with the API, not your client.

Summary of server codes:

1xx - Informational

2xx - Success

3xx - Redirection

4xx - Client error

5xx - Server error

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