Creation of the virtual directory http://localhost failed

When creating a copy of an application from Visual Source Safe, sometimes developers get the following error 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?

After clicking ‘Yes’, a new error message will be displayed:

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

All the projects will be loaded expect for a project which states unavailable and by right-clicking the project and selecting the option of editing the file with an extension of either .csproj or .vbproj.

In the file, find <iisurl> tag with localhost.( <iisurl>http://localhost/</iisurl&gt;) Change the tag details to your application name (<iisurl>http://localhost/yourapp</iisurl&gt;). Reload the project and you should be able to load the project now.

Happy Coding. 🙂

9 thoughts on “Creation of the virtual directory http://localhost failed

  1. the IIS URL tag in the .csProj file is already set to “http://localhost/yourapp”
    but it still fails… of course if I delete the Virtual directory in IIS and reload the project then it works fine…..But I have to do this every time I switch between projects…..and I have to switch often,,,, is there any solution without this process…. ? like may be VisualStudio figures out and deletes the Virtual Directory or something?


    • Try the following solution:

      Close Visual Studio.
      open IIS Management and go to the application you have issue and delete it. (You are deleting just Virtual Directory)
      Open Visual Studio and try adding again.

      Let me know if it worked !!


Leave a Reply

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

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

Twitter picture

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

Facebook photo

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

Google+ photo

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

Connecting to %s