Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
399 views
in Technique[技术] by (71.8m points)

asp.net - Visual Studio 2015 - Adding virtual directory not possible

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.

See Question&Answers more detail:os

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Reply

0 votes
by (71.8m points)

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\DocumentsIISExpressconfig 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:WebAppWebSite1"). 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.


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
OGeek|极客中国-欢迎来到极客的世界,一个免费开放的程序员编程交流平台!开放,进步,分享!让技术改变生活,让极客改变未来! Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...