使用的WebRequest localy导致异常
-
19-09-2019 - |
题
现在,我与我的第一个Windows Mobile的项目工作,我有一个奇怪的问题..结果
我使用WebRequest
从互联网上下载一些图片 - 我的手机它的工作原理,但在调试器我有插座例外
string url = "http://new.meteo.pl/um/metco/mgram_pict.php?ntype=0u&fdate=2010011006&row=381&col=199&lang=pl";
Stream stream = null;
WebRequest requestPic = WebRequest.Create(url);
WebResponse responsePic = requestPic.GetResponse();
stream = responsePic.GetResponseStream();
return new System.Drawing.Bitmap(stream);
输出:
A first chance exception of type 'System.Net.WebException' occurred in System.dll
A first chance exception of type 'System.Net.Sockets.SocketException' occurred in System.dll
The thread 0x167c46f6 has exited with code 0 (0x0).
如何强制我的本地实例来获得这个图像?
解决方案
如果您使用的设备仿真器,只需配置网络信息。
,并确保它能够与外界连接(这取决于你的网络基础设施可能无法)。
不隶属于 StackOverflow