我从烂番茄网站上得到一个 json 格式的字符串。我的代码看起来像
HttpWebRequest webRequest = (HttpWebRequest)HttpWebRequest.Create(url);
webRequest.Method = "GET";
webRequest.ContentType = "application/json";
HttpWebResponse webResponse = (HttpWebResponse)webRequest.GetResponse();
using(StreamReader reader = new StreamReader(response.GetResponseStream()))
{
//Code I'm using the reader with
}
当我运行返回 1 - 4 部电影的电影搜索时,它工作正常。但是,如果我尝试获得 5 或更多的结果,它将不起作用。webResponse 内容长度为 -1。当我返回 4 部电影的结果时,内容长度为 7,449。