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.configand 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!