Wednesday, September 30, 2009

Fail creating virtual directory

Error: Creation of the virtual directory http://localhost/web failed with error: Could not find the server 'http://localhost' on the local machine. Creating a virtual directory is only supported on the local IIS server.

This error appear as a dialog box when trying to load a project whose virtual directory had been created formerly.

Actually, there are two dialog box:
1. The first dialog box sounds: The local IIS URL http://localhost for Web project web has not been configured. In order to open this project the directory needs to be configured. Would you like to create the virtual directory now?

2. After clicking yes, the second dialog box appears: Creation of the virtual directory http://localhost/web failed with error: Could not find the server 'http://localhost' on the local machine. Creating a virtual directory is only supported on the local IIS server.


Solution:
The solutions may vary in this case. Here are some possible solutions:
1. Make sure the asp.net is already registered to the IIS. You may want to try registering it to IIS

2. The virtual directory of the project might not have been set properly, so it can not be loaded. Edit the virtual directory of the project by right-clicking the project, choose Edit project (.csproj) file, then at the bottom part of the file, you may find something like <iisurl>http://localhost/</iisurl>
Change / add the name of the web project, e.g. <iisurl>http://localhost/webname</iisurl>

3. Make sure the IIS is running well on services.msc. To check it, press windows + Run, type "Services.msc" (without quotes), then restart IIS Admin.



Afterwards, restart the IIS by pressing windows + Run, type "inetmgr" (without quotes), then start the service.



4. This is a rare case, but someones might encounter it too. If you are using another web server on your computer, e.g. Apache, xampp, etc., make sure you stop the web server first, then start the IIS. In a case I met, it still didn't work, after about half an hour trying to find the problem, I found the issue. Someone changed the port used for the web server. So, I had to change it again.
On the IIS window, right click on the Default Web Site, choose Properties, then make sure the port used is 80 (I'm not sure if using another port is ok here).

Share:

You may be intersted in

Related Posts

Updating Table Containing Xml Column via LinkedServer

If you are trying to update a table containing XML column via Linked Server in SQL Server, and you are not able to, you are not alone. There...

About Me

My photo
Is an ordinary man, with a little knowledge to share and high dreams to achieve. I'd be glad if I can help others, 'coz the only thing for the triumph of evil is for a good man to do nothing.

About Blog

You can find a lot of debugging and deploying problems while developing applications in .NET and Visual Basic here. There are also some querying tips in SQL and typical source codes which might be useful shared here.

Popular Posts

Blogroll

Followers

Leave a Message