我正在开发使用 RestClient 从 WebServer 获取信息的 WP7-8 应用程序。当我关闭互联网连接时,我看到:
System.Windows.ni.dll 中发生了“System.Net.WebException”类型的异常,并且在托管/本机边界之前未处理
这是什么意思?我该如何或应该修复它?我的代码:
RestSharp.RestClient _client;
_client = new RestClient { BaseUrl = BaseURL };
_client.Timeout = 50;
resourceString = "Http:\\blablabla";
var request = new RestRequest { RequestFormat = DataFormat.Xml, Resource = resourceString };
request.Timeout = 50;
request.IncreaseNumAttempts();
if (System.Net.NetworkInformation.NetworkInterface.GetIsNetworkAvailable() != true)
{
ErrorCallback("Internet connection Error");
return;
}
_client.ExecuteAsync(request, response =>
{
return response;
}