Speeding up localhost in Visual Studio

I recently put a new SSD in my system (yay!) and did a clean install of Windows 7, Visual Studio, etc. I found that when viewing my web app on localhost (using the Cassini web server built into VS), it was very slow. This was true across browsers.

Turns out it’s a DNS thing – the lookup for “localhost” was apparently going out to the DNS server, a waste. You can easily “short-circuit” this by modifying your hosts file. It’s in the C:\Windows\System32\drivers\etc folder.

Simply un-comment the localhost entry at the bottom of that file, like so:

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


It made things lickety-split for me.

Tip: you’ll need to run Notepad as an administrator to modify the file.

notepad

Advertisement
This entry was posted in Uncategorized. Bookmark the permalink.

Leave a Reply

Fill in your details below or click an icon to log in:

Gravatar
WordPress.com Logo

Please log in to WordPress.com to post a comment to your blog.

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Connecting to %s