开发者

Use WebRequest localy causes exceptions

开发者 https://www.devze.com 2022-12-15 19:46 出处:网络
Right now I am working with my first Windows Mobile project and I have an odd problem.. I am using WebRequest to download some images from Internet - on my mobile it works but in debugger I have socke

Right now I am working with my first Windows Mobile project and I have an odd problem..

I am using WebRequest to download some images from Internet - on my mobile it works but in debugger I have socket exceptions.

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

Output:

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开发者_JAVA技巧 code 0 (0x0).

How to force my local instance to get this images ?


If you're using the Device emulator, simply configure the network information.

And make sure it can connect with the outside world (which might not be possible depending of your network infrastructure).

0

精彩评论

暂无评论...
验证码 换一张
取 消