[英]An exception occurred during a WebClient request. in windows phone
Here I am put my code which is "An exception occurred during a WebClient request" i put breakpoint and check .it will so this error .for developing i am using visual studio 2012 ultimate with windows phone sdk8.0 and if request is done successful than my response is in json string .that will show in messagebox .now it show me "System.Net.Webexception:An exception occurred during a WebClient request." 在这里,我放了我的代码“ WebClient请求期间发生异常”,我放了断点并检查.it,所以将出现此错误。对于开发,我正在将Visual Studio 2012 Ultimate与Windows Phone sdk8.0一起使用,如果请求成功完成而不是我的响应在json字符串中。它将显示在消息框中。现在它向我显示“ System.Net.Webexception:WebClient请求期间发生异常”。
public match()
{
InitializeComponent();
Loaded += new RoutedEventHandler(profile1_loaded);
}
void profile1_loaded(object sender, RoutedEventArgs e)
{
WebClient wc2 = new WebClient();
var URI = new Uri("http://192.168.1.17/eyematch/rest1-7-2/api/match");
wc2.Headers["Content-Type"] = "application/x-www-form-urlencoded";
wc2.UploadStringCompleted +=
new UploadStringCompletedEventHandler(wc2_UploadStringCompleted);
wc2.UploadStringAsync(
URI, "GET", "action=getMatchNotificationData&sKey=" +
GlobalVariables.skey + "&uKey=" + GlobalVariables.ukey);
}
private void wc2_UploadStringCompleted(object sender, UploadStringCompletedEventArgs er)
{
try
{
MessageBox.Show(er.Result);
}
catch (Exception eu)
{
MessageBox.Show(eu.ToString());
}
}
thank you in advance.... 先感谢您....
Are you testing this in the emulator or on a physical device? 您是在仿真器中还是在物理设备上进行测试? Chances are the address is inaccessible given your network configuration (especially since it is a local network IP). 根据您的网络配置,该地址很可能无法访问(特别是因为它是本地网络IP)。
对遇到此错误消息的其他人的一个有用提示:异常具有.InnerException,因此,如果将上面的代码更改为也输出“ eu.InnerException”,则可以获得更多信息。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.