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:

17 comments:

  1. 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.

    ReplyDelete
  2. Hear hear ^^ What was the solution to your problem? Care to share it? :)

    ReplyDelete
  3. Thanks man, in my case the iisurl was pointing to https and in the iis website config protocol was in http, when change the iisurl to http all worked fine but... how do I change my website properties so it can support https?

    ReplyDelete
  4. Hi, friend, I do not quite know about this issue, but after searching in google, I find some articles which you may find useful. Check it out at http://support.microsoft.com/?id=324069 and http://support.microsoft.com/?id=298805 ^^

    Good Luck ;)

    ReplyDelete
  5. nice post!

    my problem was port number :-/
    when I changed port to 80, everything was fine...

    ReplyDelete
  6. Thanks, I migrate project from windows 7 to XP, I found same error, I found in .csproj file
    http://localhost:8080/webname

    after that I removed ":8080" changed as
    http://localhost/webname

    now its working fine!

    ReplyDelete
  7. iis express will not work from visual studio if you are lacking visual studio sp1.

    ReplyDelete
  8. On the IIS window, right click on the Default Web Site, choose Properties then set IPAddress section to -> (All Unassigned)

    ReplyDelete
  9. thank you so much...Really appreciate ur help. Very well explained...

    ReplyDelete
  10. I fixed it!! My case was, I had 127.0.0.1 bound but not "localhost" so it wasn't resolving correctly. I simply added another binding and it worked! :D

    ReplyDelete
  11. Good that you've found your problem. Thanks for the sharing :)

    ReplyDelete
  12. another issue is missing service pack and update.
    I solved mine by install VS 2010 SP 1 and 2012 Update 1.

    ReplyDelete
  13. great post, I am interesting in it!

    ReplyDelete

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