20Jan

Slow ASP.NET Development Server (Windows 7)

I recently upgraded to Windows 7 and found that running a website using the ASP.NET Development Server on Visual Studio 2008 is really slow!

 

An Ext JS web application I’m working on at the moment was sometimes taking up to a minute to load as I don’t build the javascript files every time I edit the code. I was even finding that images were taking between 2 and 3 seconds to load.

Having tried altering a few settings and playing with my anit-virus I turned to search and it lead me to reading this:

“It turns out that the slowness is caused by an IPv6 issue with DNS and can easily be resolved by turning IPv6 support off in Firefox while doing localhost testing. To make the change, type about:config in the address bar, locate the network.dns.disableIPv6 setting and double-click on it to set it to true. This does the trick for the Firefox localhost issue on Vista and everything is running fast again.” (Dan Wahlin)

I decided not to follow Dan’s advice because I need to test on other browsers (e.g. Chrome). As this problem stems from DNS resolution with IPv6 I instead fixed the problem by editing the hosts file.

It’s a straight-forward task and only takes a minute…

Quick Fix:

  1. Open Notepad in administrator mode (right click “Run as administrator)
  2. Navigate to “WINDOWSSystem32driversetc”
  3. Open “hosts”
  4. Uncomment the line “#  127.0.0.1  localhost” but removing the # from the line
  5. Save the file

Your hosts file should look similar to this now:

# localhost name resolution is handled within DNS itself.
127.0.0.1 localhost
# ::1 localhost

Hope this helps.

Comments