简体   繁体   中英

Where does Visual Studio copy the applicationhost.config file in the .vs folder from?

Visual Studio creates a hidden folder in the solution root of web projects named.vs. Inside there is a config sub-folder with an applicationhost.config file. If the.vs folder is missing Visual Studio will create it again either when I open the solution or maybe when I start the debugger.

I assume that this applicationhost.config file is being copied from some default location. I wish to find the source file and make some changes so that my preferred settings will be in effect by default.

I am currently using Visual Studio 2019 16.3.7 .

Where does Visual Studio copy this file from?

I found applicationhost.config in these locations on my PC:

  1. C:\Program Files (x86)\IIS Express\config\templates\PersonalWebServer
  2. C:\Program Files\IIS Express\config\templates\PersonalWebServer
  3. C:\Users\%USERNAME%\Documents\IISExpress\config

I altered each systematically and found that in my case Visual Studio 2019 is copying the file from path 1.

The applicationhost.config is copied from

%windir%\system32\inetsrv\config

You can get %windir% from the set command in a command window. (usually C:\windows)

From Microsoft Forum User lextm...aka Lex Li

You are encouraged to modify this file via appcmd. http://learn.iis.net/page.aspx/114/getting-started-with-appcmdexe/ Run this command at an elevated command prompt is enough. To edit the file directly, you need to elevate Notepad.exe and then open it. This is not recommended unless you are quite familiar with the syntax. The history folder contains the old copies of the config files, and editing them does not make changes to current IIS settings.

The help documents iisexpress /? /config help states:

The full path to the applicationhost.config file. The default value is the IISExpress\config\applicationhost.config file that is located in the user's Documents folder.

Of course you can change the path to whatever using the argument as well.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM