IIS Express unable to create the virtual directory

Leon picture Leon · Apr 10, 2011 · Viewed 55.2k times · Source

I'm using IIS Express to create a virtual directory at http://localhost:5000/ and received this error:

Unable to create the virtual directory. The URL http://localhost:5000/ is already mapped to a different folder...

This is because I've used the port 5000 for an old project before and it's no longer needed.

My question is, how can I remove the old mapping using IIS Express so I can create the virtual directory at the same port again?

Thanks

Answer

Garett picture Garett · Apr 15, 2011

You should be able to accomplish this in one of two ways.

  • You can remove the old project, or change its port using WebMatrix, which has an administration interface for IIS Express.
  • You can also do it by hand, by modifying the applicationhost.config file directly. The file is located in the %userprofile%\documents\IISexpress\config folder. You can find the project configuration under the <system.applicationHost>/<sites> element.

UPDATE: WebMatrix has been discontinued and support has officially ended.