Speed Up The ASP.NET Development Server

Visual Studio has had a built-in web server for years, but I’m apparently one of the few developers that still prefers IIS. Why? It’s certainly not more convenient – you have to setup a virtual directory, file system permissions, and change the debugging options. It’s because on a modern Windows OS (Vista or newer) it is so slooooooooow!

Take a look at the following Firebug stats:


There is literally no content on this page yet. I’ve got two static resources coming from the site, and I’m using the Google AJAX loader to pull in jQuery and the Maps API. Yet while even the slowest resource from Google takes a scant 144ms to load, the page and resources I’m pulling from my local machine are each taking just over a second!

Further testing showed that where Firefox and Chrome both exhibit this behavior, IE8 did not (or at least not by my seat-of-the-pants testing – the IE developer tools still don’t have a network profiler). Even stranger is that if I connect using or localhost. (notice the trailing .) things improved!

Something isn’t right here.

The Culprit: IPv6 and DNS

With Windows Vista, Microsoft included the IPv6 networking stack by default. Under Windows 7 (and probably Vista) they’ve apparently left resolution of localhost up to DNS. As far as I can tell the slowness isn’t the browsers’ fault, but rather the system trying to resolve localhost using IPv6.

Fortunately the fix is easy. Fire up Notepad (or your text editor of choice) as an Administrator, and open up your system’s hosts file (typically C:WindowsSystem32driversetchosts). You should see that all entries are commented out. Simply uncomment (remove the #) from the IPv4 localhost entry only, save the file, and restart your browser.


Once this is done, things look much, much better when using Visual Studio’s development server. As we’d expect, the local resources are significantly faster than the external ones.


in Blog | 317 Words