Simple use of WebClient on Windows Phone 7 throws a NetworkError

ぃ、小莉子 提交于 2019-12-25 16:41:38

问题


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);

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.


回答1:


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

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

Proxy Support for Windows Phone Emulator



来源:https://stackoverflow.com/questions/3295929/simple-use-of-webclient-on-windows-phone-7-throws-a-networkerror

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!