简体   繁体   English

WebClient请求期间发生异常。 在Windows Phone中

[英]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.

相关问题 Windows服务WebClient请求期间发生异常 - Windows Service An exception occurred during a WebClient request WebClient请求期间发生异常 - Exception occurred during a WebClient request 使用任务计划程序时“WebClient 请求期间发生异常” - "An exception occurred during a WebClient request" when using the Task Scheduler 使用webclient下载大文件时出现“ WebClient请求期间发生异常” - Getting “An exception occurred during a WebClient request” while download the large file using webclient 执行当前 Web 请求期间发生未处理的异常。 ASP.NET - An unhandled exception occurred during the execution of the current web request. ASP.NET 如何修复“在执行当前 Web 请求期间发生未处理的异常。” - How to fix "An unhandled exception occurred during the execution of the current web request. " 当前Web请求的执行期间发生未处理的异常。 型号兼容性无法检查 - An unhandled exception occurred during the execution of the current web request. Model compatibility cannot be checked 为什么从网站下载图像时出现异常:WebClient请求期间发生异常? - Why when downloading images from a website im getting exception: An exception occurred during a WebClient request? 使用C#ASP.NET时,“WebClient请求期间发生异常” - 'An exception occurred during a WebClient request" while using C# ASP.NET Windows Phone 8 RestSharp请求。 异步/等待 - Windows phone 8 RestSharp request. Async/await
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM