我的应用程序像这样调用我的 api:
Debug.WriteLine ("Making an API request: " + action);
var request = HttpWebRequest.Create("http://domain.com/api/"+ action");
request.ContentType = "application/json";
request.Method = "GET";
string content = "d";
using (HttpWebResponse response = request.GetResponse() as HttpWebResponse)
{
using (StreamReader reader = new StreamReader(response.GetResponseStream()))
{
content = reader.ReadToEnd();
}
}
return content;
这已经完美运行了几个月。突然有一天,我的应用程序不再工作了。调试我发现请求要么超时要么抛出错误:
(System.Net.WebException) Error getting response stream (ReadDone1): ReceiveFailure
这个错误是什么意思?为什么突然开始?自应用程序发布以来,此代码未更改。该请求在输入浏览器时可以完美运行。