Monday, March 23, 2009

Visual Studio 2005/2008 on Vista Internet Explorer cannot display the webpage

I faced a strange problem with Visual Studio 2005 and Visual Studio 2008 which is I have several ASP.NET Projects some of them using .NET 2.0 or Visual Studio 2005 and the others are using .NET 3.5 or Visual Studio 2008.

The problem was when I try to run the Web Application I got this error:

Internet Explorer cannot display the webpage

I am not using IIS for these Web Application. I have tryied the usual solutions such as Restart the Visual Studio, Restart my Laptop and Reinstall Visual Studio but nothing solve this problem. After searching for a solution for this problem I finally got the answer.

All you have to do is editing the host file located here %windir%\System32\drivers\etc\hosts

Open this file with Note Pad don't forget to right Click and Run as administrator. Just comment the line that contains localhost as shown below:

No restart is needed, either of computer or Visual Studio.

# Copyright (c) 1993-2006 Microsoft Corp.
#
# This is a sample HOSTS file used by Microsoft TCP/IP for Windows.
#
# This file contains the mappings of IP addresses to host names. Each
# entry should be kept on an individual line. The IP address should
# be placed in the first column followed by the corresponding host name.
# The IP address and the host name should be separated by at least one space.
#
# Additionally, comments (such as these) may be inserted on individual
# lines or following the machine name denoted by a '#' symbol.
#
# For example:
#
# 102.54.94.97 rhino.acme.com # source server
# 38.25.63.10 x.acme.com # x client host
# 127.0.0.1 localhost
# ::1 localhost

Source: https://www.nilebits.com/blog/2009/07/visual-studio-2005-2008-on-vista-internet-explorer-cannot-display-the-webpage/

3 comments:

  1. yes I faced this problem and I searched the cause and how to fix and found that it is caused by some an update for vista ,it edits in the host file and remove the reference localhost that refers to which is 127.0.0.1 ... just make re-reference

    # 127.0.0.1 localhost

    ReplyDelete
  2. I think another solution would be run Visual studio as an administrator. In start menu Right click Visual Studio and choose Run As Administrator. My personal advice man is to get rid of Vista as It has never been meant for developers and would reduce your productivity. I spent 3 months of my development life on Vista and gone with no return :D .

    ReplyDelete
  3. Very good article thank you

    ReplyDelete