1

I get a

Stack Trace:

[SocketException (0x2af9): No such host is known]
   System.Net.Dns.GetAddrInfo(String name) +471

when trying to debug an ASP.NET web site on a laptop that has no network interfaces connected.

It is logical since no DNS server is present to resolve the localhost GetAddrInfo call. How do I work around this issue and allow myself to debug web site in a disconnected environment?

Maxim V. Pavlov
  • 10,303
  • 17
  • 74
  • 174

2 Answers2

0

I'm a pretty dedicated "hack great things on long plane flights" guy. The long term answer is you design the app to work in a disconnected environment. This is tougher with today's apps that tend to rely upon public internet services to function. Then again they are putting wifi on planes.

Anyhow, specific advice is hard to give as the important question is "why are you hitting the external host in the first place". If you only have a a limited number of sites it reaches out to and it can handle not being able to talk to the external services in question you could use the windows hosts file to provide your own local DNS services. You could probably fake some more things behind that. But that does not scale well in general.

Wyatt Barnett
  • 15,573
  • 3
  • 34
  • 53
  • The problem is with a ClientDependency library I use in ASP.NET project. It just tries to query the localhost (I guess) and can't resolve it. Localhost is hardcoded in a hosts file and the lines are uncommented. I guess `System.Net.Dns.GetAddrInfo(String name)` needs and actual DNS server and hosts just doesn't suffice for it. – Maxim V. Pavlov Sep 08 '12 at 15:22
  • I'd figure out exactly what it is querying for, pretty hard to bypass the local hosts file in my experience. And I've done alot of stunt networking involving creative uses of DNS. Also, if it is http://clientdependency.codeplex.com/ then it is probably looking to hook up with CDNs. See previous statement about being tougher in today's apps that presume you are on the public internet. – Wyatt Barnett Sep 08 '12 at 15:28
0

You could add a virtual network card. That should bypass the problem with the DNS. Here are few options on doing that:

How do you create a virtual network interface on Windows?

Community
  • 1
  • 1
Bogdan Gavril MSFT
  • 20,615
  • 10
  • 53
  • 74
  • There is a microsoft km-test loopback adapter virtual network card, but it's just not changing the game and `System.Net.Dns.GetAddrInfo(String name)` still fails. – Maxim V. Pavlov Sep 08 '12 at 15:30
  • What if you install Virtual PC? It should create a bridged network to a VM, but you don't care, just that it might activate the DNS. – Bogdan Gavril MSFT Sep 08 '12 at 15:40