Tuesday, 18 August 2009

ASP.NET- Unable to Start Debugging

We've been around ASP.NET since it was a baby, and have lost track of the number of times we've seen the pesky "unable to start debugging" message from Visual Studio. There are a zillion things that can cause it, and about two years ago we found the zillionth and first - one of the Windows updates hijacked a critical file.

Two years is a long time, and having just encountered yet another dead stop, we've just had to go through the whole sorry process again, to rediscover the same issue.

If you're at your wits' end with the self-same message, take a look at your "hosts" file (no, we didn't know we had one either)...

It's in the snappily-titled c:\windows\system32\drivers\etc and it's called simply "hosts" - it doesn't have a file extension. You'll need to be running as the administrator to mess with it (or right click on Notepad and take the "run as administrator" option) and inside (apart from some comments) you'll find the line:

127.0.0.1 localhost

and you may or may not find a second line:

::1 localhost

That second line may have been trashed - if it ain't there, add it in and save the file, and savour the joys of being able to create a new ASP.NET web site in IIS and debug it once again. Yip, it sounds like science fiction, but it's true.

We're a little unclear on the significance of it (and if anyone finds a human-readable piece on what on Earth an IPv6 loopback is do let us know). We're client-side graphics geeks, not server-side infrastructure boffins, and we're also sure there are good reasons for the horrific complexity of web site infrastructure. Okay, we're not at all sure there are.

In passing, if you ever wondered how the string 'localhost' became associated with the IP address '127.0.0.1', it's because of this file. You can add extra entries here too, so if you wanted to associate 'www.Vixer.co.uk' with '127.0.0.1' as well, you'd add an extra line into this file.

We have a side project running which is all about making the massively complex digestible through the use of graphics, and while it was never designed to deal with things that have grown up through the tangled machinations of standards bodies combined with knee-jerk reactions to unanticipated threats from hacker vermin, sprinkled liberally with dollops of glue to deal with its own ghastly legacy, it would nevertheless be an interesting exercise to try to go from "it's like this" to "and this is why". Still, we're ranting now...

No comments:

Post a Comment