我正在C#Win8 CP上基于xaml的metro应用程序内部进行调用; 此调用只是命中一个Web服务并返回JSON数据.
HttpMessageHandler handler = new HttpClientHandler();
HttpClient httpClient = new HttpClient(handler);
httpClient.BaseAddress = new Uri("http://192.168.1.101/api/");
var result = await httpClient.GetStreamAsync("weeklyplan");
DataContractJsonSerializer ser = new DataContractJsonSerializer(typeof(WeeklyPlanData[]));
return (WeeklyPlanData[])ser.ReadObject(result);
Run Code Online (Sandbox Code Playgroud)
它挂起,await但http呼叫几乎立即返回(通过提琴手确认); 就好像await被忽略了它只是挂在那里.
在您询问之前 - 是 - 打开了专用网络功能.
任何想法为什么会挂起?