(500) 内部服务器错误 - 使用 api 发送 Web 请求时 [英] (500) Internal Server Error - When sending web request using api

查看:60
本文介绍了(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

这篇关于(500) 内部服务器错误 - 使用 api 发送 Web 请求时的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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