Reputation:
I had to delete my applicationhost.config, because VS 1012 didn't deal with it. How can I create it? thank you.
Upvotes: 25
Views: 31296
Reputation: 2033
Per my 2019 Visual Studio, deleting the file and starting the project automatically created a new one. I made a backup of the file first just in case.
Upvotes: 0
Reputation: 2403
Update for Website projects using Visual Studio 2019:
When working with a website project on your workstation using IISExpress, Visual Studio creates and references the applicationhost.config
file located in the following location:
<your solution file folder>\.vs\<your solution name>\config\applicationhost.config
NOTE: the .vs folder is a hidden folder.
It appears to me that Visual Studio is creating applicationhost.config
by copying the contents of an applicationhost.config
from this location:
C:\Program Files (x86)\IIS Express\config\templates\PersonalWebServer\applicationhost.config
[Credit for the above location goes to Matthew MacFarland, in his answer here: https://stackoverflow.com/a/58789448/32700]
You can copy the content from that location into your project's applicationhost.config
and move forward.
Of course, you might need to repeat any steps in Visual Studio that would have modified the contents of applicationhost.config
or repeat any changes you've made.
I have experienced a total loss of my project's applicationhost.config
contents by editing the file while my project was open in Visual Studio 2019.
Thus, if you are going to manually change your applicationhost.config
- I recommend that you make a backup copy prior to making changes, just in case the file is different that the template.
Further, an alternate way to recover a lost or corrupt applicationhost.config
is to create a new Visual Studio Solution, copy the files from the old solution folder except the old solution file (of course) and the hidden .vs
folder. Then use "Add Existing Website" to add the project(s) to your new solution. Visual Studio will setup all the necessary stuff under the .vs
folder.
Upvotes: 1
Reputation: 61519
After you deleted applicationhost.config
you do not need to run iisexpress.exe
manually, you can simply load your project in Visual Studio
and run it. Visual Studio will take care of that plus it will change applicationhost.config
with settings for that project specified in project Properties window (not mouse menu properties).
It will add corresponding override section at the bottom of applicationhost.config
<location path="...WebServices">
<system.webServer>
<security>
<authentication>
<anonymousAuthentication enabled="false" />
<windowsAuthentication enabled="true" />
</authentication>
</security>
</system.webServer>
</location>
Upvotes: 11
Reputation: 2919
Just run IISExpress and it will recreate the file for you. The exe is located at: "c:\Program Files\IIS Express\iisexpress.exe".
Hope this helps.
Upvotes: 38