在Windows Phone 7上简单使用WebClient会引发NetworkError [英] Simple use of WebClient on Windows Phone 7 throws a NetworkError

查看:158
本文介绍了在Windows Phone 7上简单使用WebClient会引发NetworkError的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

此代码适用于WPF应用程序,但会在WP7中引发NetworkException(服务器未找到)。为什么不同?

This code works in a WPF app but throws a NetworkException ("server not found") in WP7. Why the difference?

WebClient client = new WebClient();

client.DownloadStringCompleted += new DownloadStringCompletedEventHandler(Client_DownloadStringCompleted);
Uri token = new Uri("http://www.bing.com");

client.DownloadStringAsync(token);

更新:在调试WP7时,看起来像是运行Fiddler的原因。 Fiddler还打破了仿真器上的浏览器。如果我找到使用Fiddler调试仿真器的解决方法,将发布。

Update: It looks like running Fiddler while debugging WP7 was the cause. Fiddler also breaks the browser on the emulator. Will post if I find a workaround for using Fiddler to debug the emulator.

推荐答案

确认它在这里工作。如果您想要样本,可以发布代码。

Confirmed it works here. Can post code if you want a sample to try.

如果您无法从仿真器通信出网络,可能会考虑代理支持doco 。

Might be an idea to check the proxy support doco if you're having trouble communicating out of the network from the emulator.

Windows Phone仿真器的代理支持

这篇关于在Windows Phone 7上简单使用WebClient会引发NetworkError的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆