remove virtual directory in IIS Express created in error

若如初见. 提交于 2019-12-09 07:57:10

问题


I clicked on create virtual directory of the web tab of the properties menu. My application now isn't running (the published version is) It just hangs when any of my controllers code is executed I think I've messed up the IIS config Can anyone help me out?


回答1:


My file was located here:

C:\Users\YourUserName\Documents\IISExpress\config\applicationhost.config

Entries will look like this

<application path="/virtualDirectoryName" applicationPool="Clr4IntegratedAppPool">
                    <virtualDirectory path="/" physicalPath="C:\projects\Project1" />
                </application>



回答2:


None of this worked for me - possibly because I'm working with a later version of the tools (VS 2017). I finally found the correct appplicationhost.config file in the .vs directory for the solution, edited it, rebooted, and it worked.




回答3:


If you created another virtual directory by mistake, go to your .vs folder inside your solution/project folder and look for a file called:

applicationhost.config
and change/fix what is inside the tag:
<sites>
   <site name="YourSite" id="1">
      ...
   </site>
   ...
</sites>

Hope this helps! :D




回答4:


You can use appcmd.exe in C:\program files (x86)\IISExpress

appcmd list vdir should list the virtual directories and appcmd delete vdir VDIR.NAME to delete. Or, if you use Powershell, the commands start with .\, e.g., .\appcmd list vdir.




回答5:


I faced the same issue today. The simplest way to deal with this is just simply change the Port number. Go to the Properties of the Project which you have made as Startup Project. Then...

Click to view => Step 1

Let's say the initial port number is 62168. Just increment it by 1.

Click to view => Step 2

And create a new virtual directory. Now execute the project again. This time it'll work.

Steps:

Go to Properties window of the project selected as the StartUp Project

Select the "Web" section present in the LHS of the Properties window

Go to the Servers part (which is present below the "Start Action" part )

In the Project URL section, increment the value of Port Number by 1 or 2 (modified Port number must be free) and click on "Create Virtual Directory"

Save the changes and run the application using CTRL+F5

Hope this helps!




回答6:


I realize this has been answered a few times over, but had this exact same issue in VS 2019 so I performed the following steps:

  • Closed the Solution
  • Navigated in the file system to the .vs folder within my solution and deleted it
  • Reopened Solution and rebuilt.

Upon reopening the solution and Starting the project, it appeared to have worked without any sort of reboot.

Some may consider deleting the .vs folder destructive in some way but given the fact it's normally excluded from most (if not all source control systems) there isn't really anything mission critical in there and it all gets rebuilt anyways.



来源:https://stackoverflow.com/questions/22596366/remove-virtual-directory-in-iis-express-created-in-error

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!