我正在尝试使用api来获取有关电影的信息, 我正在使用this api它实际的作品。WebResponse slow
唯一的办法就是减速,我想知道是否有更快的方法来做到这一点?我必须说,这对我来说是比较新的。这是索姆代码。
public string Connect()
{
WebRequest request = WebRequest.Create(this.url);
request.ContentType = "application/json; charset=utf-8";
//this is slowing me down
WebResponse response = (HttpWebResponse)request.GetResponse();
using (StreamReader sr = new StreamReader(response.GetResponseStream()))
{
jsonString = sr.ReadToEnd();
}
return jsonString;
}
public static string GetFilmInfo(string titel)
{
MakeCon checkVat = new MakeCon("http://www.imdbapi.com/?i=&t=red" + titel + "/");
JsonSerializer serializer = new JsonSerializer();
string jsonString = checkVat.Connect();
return JsonConvert.DeserializeObject<string>(jsonString);
}