2/4/09

Slow localhost loading in Firefox when using Visual Studio Web Development Server (but not when using IE)

I was trying to debug a ASP.NET project using the Visual Studio Web Development Server (WDS) and the pages in Firefox would come up extremely slow. Normal speed with all other browsers, IE 6,7 and Chrome, and Safari.

Well, it turns out that Firefox 3 by default will try to resolve IPv6 addresses when requesting a URL. When it can't find one, a time out must pass before it returns a result. The localhost address used by the WDS won't have an IPv6 address, and thus when FF asks for localhost, it gets delayed looking up the IPv6 address.

FF will then do this for every item on the page, image, js, css, etc...

The fix involves adjusting the Firefox settings to NOT try to resolve the IPv6 addresses for a given domain.

Derek here offers a solution to fix the problem by turning off the IPv6 lookup feature completely, however there is also a way to allow Firefox to just disable the DNS lookups for a particular domain name, not just turn off the feature all together.

To only exclude a given domain name from IPv6 lookups:
  1. Start Firefox
  2. In the address bar, type in "about:config"
  3. Accept the warning
  4. In the filter box type in: "network.dns.ipv4OnlyDomains"
  5. Double click the one entry that should show up
  6. Type in "localhost" and any other domains (comma separated) > OK
  7. Changes should take affect immediately
To turn off IPv6 lookups entirely:
  1. Start Firefox
  2. In the address bar, type in "about:config"
  3. Accept the warning
  4. In the filter box type in: "Network.dns.disableIPv6"
  5. Double click the one entry that should show up, to change it to true
  6. Changes should take affect immediately
More info about these magic properties:

0 comments:

Post a Comment

Anyone can write comments. However they will not show up immediately, as they will be checked for spam, relevance, etc...