Wednesday, October 22, 2014

Unable to create the virtual directory. The URL ... is already mapped to a different folder

I setup my web project to run locally using IIS Express.  It worked for a while, but eventually I started getting the following error:

Unable to create the virtual directory. The URL ... is already mapped to a different folder

I wasn't quite sure what I'd changed to cause this to start happening.  I'd get this error when I was opening my solution.  My web project wouldn't even load.  I had to edit the csproj file manually and change my project to use "localhost".


This would allow my project file to open, but it wouldn't solve the problem.  When I changed it back from LocalHost it would just break again.

SOLUTION:
I found that my IISExpress had been cluttered up by past configurations and projects.  I had to clean up my applicationhost.config file, which is located here:

<UserProfile>\Documents\IISExpress\config

I just searched this file for my project folder path and removed sites that referenced that same path.  Once I did that, I could change my project back to something other than LocalHost and everything worked fine.


1 comment: