Visual Studio 2015 - Adding virtual directory not possible

Dominik G picture Dominik G · Sep 21, 2015 · Viewed 24.5k times · Source

we are running some of our sites as Web Site projects in Visual Studio. We recently upgraded to VS2015. Now we can't add virtual directories to new websites.

We already tried right-click "Add new virtual direcory" where we get an error message as well as editing the applicationhost.config in the Project folder.

Is this a bug with VS2015 or is there a way to create the directories? There is no problem with project that already ran on IIS Express before upgrading to VS2015.

PS: I know of the thread here but it doesn't help.

Answer

Ritesh Patel picture Ritesh Patel · Sep 26, 2015

FileSystem Web site to IIS Express.

  1. Open VS2015 (Right click and select Run as administrator).
  2. Click File > New > Web Site...
  3. In the New Web Site dialog, click Browse... button.
  4. Select Local IIS in the left pane. And select IIS Express Sites in the right pane.
  5. There are 4 buttons in right side on top. Click Create New Site button.
  6. Give name and click Open.This will select HTTP in Web location.
  7. Click OK.
  8. Then close the solution.
  9. Open applicationhost.config from Users\\Documents\IISExpress\config folder. You can open in the notepad.
  10. Find your web site in sites section. And change the physical path inside (virtualDirectory path="/" physicalPath="C:\WebApp\WebSite1"). Write the path of your existing Web Project.
  11. Save and close applicationhost.config file.
  12. Run VS2015 (Run as administrator).
  13. Click File > Open > Web Site...
  14. In the Open Web Site dialog, select Local IIS from left pane.
  15. Select your site under IIS Express Sites and click Open.
  16. Click Web Site menu and New Virtual Directory...
  17. Give Alias Name and Folder path and click OK.

Now you can create it without error.