简体   繁体   中英

How can I configure network access for the Windows Phone emulator?

I'm trying to debug an application that is making a WebRequest synchronously, ie.:

HttpWebRequest req = WebRequest.Create(new Uri("http://www.stackoverflow.com/")) as HttpWebRequest;

IAsyncResult res = req.BeginGetResponse(callback => { }, req);
while (!res.IsCompleted)
{
    System.Threading.Thread.Sleep(100);
}
// Doesn't matter what's here, as `res.IsCompleted` never returns true

This is just to check that some of the application logic is "right", but it's getting stuck, with the IAsyncResult never reporting itself as complete.

To check, things, I tried to use Inte.net Explorer on the emulator, but found that is unable to find any webpages (including the built in favourites), which makes me think that the emulator is trying to use a specific.network interface on my laptop, but there doesn't seem to be any way to configure it, or which interface to use? I have a suspicion that it may be trying to use a VPN interface, or a virtual adaptor like the one for VirtualBox. So, how can I configure it? additionally, would you expect requests made by the emulator to show up in Fiddler?

For the record, NetworkInterface.GetIsNetworkAvailable() returns true ;

UPDATE:

It appears that updating my graphics driver (and associated reboot) allowed the emulator to access the real.network (or at least guess the right adapter); however, res.IsCompleted still doesn't report true (and Fiddler shows the request has completed), so I'm a little confuddled.

Are you using a proxy? The Windows Phone emulator is tied to the currently active Inte.net Connection, as well as the proxy settings. Make sure those are set up correctly. Also, there might be a firewall blocking Inte.net access for XDE - check the settings too.

I would recommend getting Fiddler . Attempt to configure it to capture emulator traffic and see what information you can get from there.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM