Automatic Virutal Directory Creation Failing in VS2010

One of the projects I work on involves a WCF service that is set up to run under IIS instead of the Visual Studio Development Server. This project has a couple of branches that from time to time are merged back into the trunk, which sometimes leads to the following error if the developer is prompted by Visual Studio to automatically create the virtual directory for the service to run under:

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

The reason this error occurs is because, based on which branch was being used when the file was committed to source control, the directory could be different.

I figured this would be a pretty easy thing to fix -- just delete the virtual directory in question. But I was surprised to go into IIS Manager and find wasn't there. Yet I could go to the URL in question and receive an error page that suggested that the URL was, in fact, valid.

The fix was somewhat less obvious, but I found it. Here are the steps for resolving this when running under Windows 7 -- the steps may vary slightly in older versions:

  1. Select the applicable web site under the Sites node in the Connections pane on the left side of the window.
  2. Click View Applications in the Actions pane on the right side of the window. This will show the Applications view.
  3. Select the item from the Applications view with the URL you're trying to create. Then click Remove from the Actions pane on the right side of the window.


Moaz Jutt said…
hi this is Moaz,
i am facing the same problem as u explained above, but the solution you provided in the last is not very understandable.
Kindly explain the each step.
Kind regards

Anonymous said…
Thks !! =) Great and fast post

Popular posts from this blog

A Generic Method Using HttpClient to Make a Synchronous Get Request

The Cause and Solution for the "System.Runtime.Serialization.InvalidDataContractException: Type 'System.Threading.Tasks.Task`1[YourTypeHere]' cannot be serialized." Exception

How To Mock Out Child Components In Unit Tests of Angular 2 Code