private Dictionary<string, Object> GetLocation(string imei)
{
#region===代码===
string serviceAddress = string.Format("http://localhost/api/car/getlastinfo?imei={0}&key=xxxxx",imei);
HttpWebRequest req = (HttpWebRequest)WebRequest.Create(serviceAddress);
req.Method = "get";
req.KeepAlive = false;
var resp = new StreamReader(((HttpWebResponse)req.GetResponse()).GetResponseStream(), Encoding.GetEncoding("utf-8"));
string res = resp.ReadToEnd();
resp.Close();
Dictionary<string, Object> dic = null;
if (res != "")
{
dic = JsonConvert.DeserializeObject<Dictionary<string, Object>>(res);
}
return dic;
#endregion===代码===
}

解决:设置  req.KeepAlive = false;

05-11 16:06