Tuesday, 8 July 2008

Creation of the virtual directory http://localhost/ failed

On attempting to check out a project in VS2008, I got the following message:

The local IIS URL http://localhost/ specified for Web project DemoWebsite has not been configured. In order to open this project the virtual directory needs to be configured. Would you like to create the virtual directory now?

On clicking yes, I got the following error:

Creation of the virtual directory http://localhost/ failed with the error: The URL 'http://localhost/' is already mapped to a different folder location.

The rest of the solution checked out all right, but the above project did not; it was marked as unavailable. I right-clicked the project node in the solution explorer and selected the option to edit the project (.csproj) file. Near the bottom of the file, I found the following:

<iisurl>http://localhost/</iisurl>

I edited this entry to add a virtual directory:

<iisurl>http://localhost/myapp</iisurl>

Having saved the change, I then right-clicked the project node in the solution explorer again and reloaded the project. When I was prompted to create the virtual directory again, the creation was successful and the project checked out. The virtual directory is created under the running web site in IIS (on Windows XP).

22 comments:

Neha said...

Neil, thanks to you simple explanation, I was able to resolve it in a matter of minutes. Thank you.

Saraswathy said...

This worked like a charm for me too, thanks for sharing this info!!
Saras

Neil Pullinger said...

Glad to be of assistance!

kris said...

THANK YOU!!!

seth said...

I was unable to find IISUrl tag in the .csproj file. Though I manually added this and it worked.

Thanks

Terry said...

Worked brilliantly. Many thanks

Akhilesh said...

Thanks Neil, this works, I was able to solve my problem.
Thanks a lot of you..

Aby_The_One said...

Thank you so much. This solved my issue.

timb said...

Thank you! This solved my issue I was having.

Amin Sayed said...

Thank you so much Neil. Appreciate your knowledge sharing.

Amin Sayed said...

Thanks Neil. Appreciate your knowledge sharing.

eda said...

great work; thanks Neil ;)

Ray L said...

thanks Neil. That did the trick here also. I'm converting an app written in VS 2005 to VS 2010 and had same problem.

raj said...

Thanks
Struggling from 2 days and only your one suggestion worked for me.
keep it up the good work for people like me.

Tarek said...

Thanks , you saved my day

Surajit said...

Thanx,I got my problem solved by editing the tag that you have mentioned as per requirement.

Sipho said...

Sweet Neil. Good work.

Miru Sharma said...

Thanks Neil.. Great job.. it WORKS!!!

ag_words said...

Thankz..Worked like a charm..!!!
Thankz a ton..!!

Jafar said...

Thanks Neil!

SUNNY aka MAINAK said...

Thanks a lot..!!! I went through a lot of websites before I ended up here. Your solution is so simple and effective, and does not even require installing tons of useless software. Keep up the good work!

rankesh nath said...

Thanks Buddy.....Worked like a charm......