4

I'm fairly new to Windows Phone development, and I'm trying to accomplish something which I thought would be fairly straightforward to do.

Whenever I develop using ASP.NET, I always create a site in IIS, and create a domain for the development version which I add to my hosts file at point at my local IP (eg: www.mysite.local points to 127.0.0.1). This works fine when developing and testing directly on my machine.

However, I'm currently building an API (using the URL api.mysite.local) that will be consumed by a Windows Phone 8 app - and I'm curious whether there is any way to mimic the same thing using the emulator. I would have expected that the emulator (or Hyper-V which it runs on) might use the Windows hosts file under the hood, but it doesn't seem to. Nor does there appear to be any way to add a host file mapping specifically for it.

Is this not possible? The only way I've been able to accomplish it is by using the IP address. But this means I now have different virtual directories for different apps (eg: http://xx.xx.xx.xx/api, http://xx.xx.xx.xx/website, etc) - which I don't really like. I'd ideally like to use the same, full URL.

stevehayter
  • 796
  • 1
  • 7
  • 23

2 Answers2

2

I haven't tried, but there should be a way to do that using Fiddler.

First install Fiddler, and start it before starting the emulator. From there, the emulator will automatically use Fiddler as a proxy. Since Fiddler runs on your computer, it should use your hosts file, giving you the result you wanted. If it doesn't, you can force it using host remapping (in the Tools menu, click on "HOSTS").

Kevin Gosse
  • 38,392
  • 3
  • 78
  • 94
  • Sounds promising KooKiz... thank you. I will give it a try when I get home and let you know the results. – stevehayter Mar 08 '13 at 11:46
  • @stevehayter did you ever get Fiddler to do your bidding? If yes, how? If no, did you get to solve the problem? – Eniola Dec 26 '15 at 14:43
0

You should change the DNS configuration on your PC to point at 127.0.0.1

Then install Acrylic, Maradns, pDNS or some other local DNS server/proxy and configure it with your hostnames. (pDNS in particular is extremely minimalistic.)

Prof. Falken
  • 24,226
  • 19
  • 100
  • 173