gpt4 book ai didi

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

转载 作者:太空狗 更新时间:2023-10-29 23:08:18 26 4
gpt4 key购买 nike

我正在发送网络请求并收到内部服务器错误: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;

最佳答案

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

服务器代码汇总:

1xx - Informational

2xx - Success

3xx - Redirection

4xx - Client error

5xx - Server error

完整的代码列表请看这里:http://support.microsoft.com/kb/943891以及关于 500 代码的具体信息:http://support.microsoft.com/kb/942031

关于c# - (500) 内部服务器错误 - 使用 api 发送 Web 请求时,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/18713666/

26 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com