Speed up the Visual Studio Development Web Server

Here’s a fix to a problem many people don’t realize they’re having!  When you debug a web site project in Visual Studio, by default, a simple little web server called ‘Visual Studio Development Web Server’ (previously known as Cassini) fires up so you can test your site with whatever browser or tools you want:

image

You’d think that since this tiny little web server runs on the local machine, everything should be pretty speedy, right?

Well, it’s not.  Sometimes, it kind of works.  Sometimes, it times out.  And here’s the problem: IPv6.  I hate this technology.  Sure, it might be necessary, but it’s a pain-in-the-ass over-engineered solution that is going to cause everybody a LOT of grief over the next few years. By default, Windows tries to use IPv6 first.  Why?  Because it’s so much more awesome, I guess.  Unfortunately, the web server built into Visual Studio doesn’t play nice with IPv6.

I offer you several fixes here.  Pick the one you hate least!  Note that these fixes can on occasion be a bit finicky; you may have to restart your browsers, flush DNS caches, restart your computer, or scream and curse for a while.

The Quick Fix

When you start your project, your browser will be sent to an address like this (the port number will be random):

http://localhost:1805/

Simply change localhost to 127.0.0.1, so the address looks something like this (leaving the original port number):

http://127.0.0.1:1805/

Remember to include the ‘http://’ in the URL you type here.  Ugly, yes, but it works instantly, you don’t need to reconfigure anything, and you don’t need admin access.  The down side is that you have to do this every time you launch the project.

The Easy Fix

Want to fix this issue permanently?  The best way is to edit your hosts file, which you’ll find here:

%WINDIR%\System32\drivers\etc\hosts

Towards the bottom, you’ll find this line:

#    127.0.0.1       localhost

Uncomment this line by removing the ‘#’.  Then save the file.

There’s another line right after this that mentions ‘::1’; leave this one the way it is.  This file is protected, so the easiest way to save it is to save a copy to your desktop and then move this copy to the original location; this way Windows offers you the opportunity elevate and overwrite rather than simply give you a ‘read only’ error.

This fix should instantly take care of the problem machine-wide.  In theory, this shouldn’t break anything – IPv6 is still turned on, and resolution still works – but if this is a server, you might want to test things through.

The Browser-Specific Fixes

There are options within some browsers to disable IPv6.  Doesn’t seem like the best way of going about solving this problem, but hey, you do what you gotta do.

In Firefox, browse to about:config and toggle the network.dns.disableIPv6 preference:

image

In Chrome, start the browser with the “--disable-ipv6” argument.  Note that the dashes are a bit awkward; you have to get this exactly right.  See our (outdated) article Google Chrome on Windows 7 for more details on making this change in your shortcuts.

Other Fixes

There are other ways of fixing this out there.  These include various ways of disabling IPv6, registry hacks, and editing the web.config file.  None of these are particularly ideal, unless you know exactly what you’re doing (in which case, why are you reading this?).  Note that disabling IPv6 (as some existing articles out there will tell you to do) will break things!

3 comments:

  1. Speed up the Visual Studio Development Web Server is proving better service which i have liked which will be informative to me as well. Keep it up.
    Kallis

    ReplyDelete
  2. Casino in India » Review by Casino Experts 2021
    Casino in 룰렛 판 사이트 India Review 스포츠 사이트 ➤ Find all the ☆ Best Casino in India ➤ Sign up with us ✚ Bonuses for 벤 델핀 Indian Players 블랙 잭 ➤ Claim Bonus 100% 프라하 사이트 Up To ₹10000

    ReplyDelete


Copyright © 2010 Paul Guenette and Matthew Sleno.