在这里,我放了我的代码,即“在 WebClient 请求期间发生异常”,我放了断点并检查。它会因此出现此错误。对于开发,我正在使用带有 windows phone sdk8.0 的 Visual Studio 2012 Ultimate,如果请求成功完成比我的响应是在 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());
}
}
先感谢您....