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?
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>
-
1I did this, but it keep creating the site every time i run the project. – messed-up Jun 28 '17 at 20:16
-
Check the project settings, make sure the deploy setting doesn't specify the virtual path. – BraveNewMath Jul 21 '17 at 16:09
-
If using Visual Studio 2017 the configuration file might be hidden in a
.vs
folder that's not visible. – Jeremy McGee Mar 2 '18 at 8:02 -
I deleted the applicationhost.config file, restarted Visual Studio and it worked. – T.J.Kjaer Nov 22 '18 at 13:10
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.
-
2Thanks! Removing competing bindings from different projects in VS 2017 (.vs directory) and rebooting fixed this for me – Matt Sanders Jan 10 '18 at 20:41
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
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
.
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!
-
Could you please add text descriptions of where to make these changes, as well as the images? – Brisbe Oct 5 '18 at 15:44
-
1