Why are there multiple ApplicationHost.config files?

135 views Asked by At

I've found ApplicationHost.config in the following directories:

  1. C:\Windows\System32\inetsrv\config
  2. %USERPROFILE%\My Documents\IISExpress\config
  3. C:\MyApp1\.vs\App1\config

Why are there multiple ApplicationHost.config files and what are they used for?

If I want to change the bindings just for my local ASP.NET app running in Visual Studio, which file do I edit?

1

There are 1 answers

8
samwu On

C:\Windows\System32\inetsrv\config\ApplicationHost.config

This ApplicationHost.config is the root file of the configuration system when you are using IIS 7 and above. It includes definitions of all sites, applications, virtual directories and application pools, as well as global defaults for the web server settings. More information you can refer to this link: Introduction to ApplicationHost.config.

C:\Users\david\My Documents\IISExpress\config\ApplicationHost.config

IIS Express and IIS use the ApplicationHost.config file, which specifies global settings for sites, application pools, handlers, etc. IIS Express uses a default, user-specific ApplicationHost.config file to allow many users to share the same computer without interfering with other user's settings. This file is located in the %userprofile%\Documents\IISExpress\config folder or %userprofile%\My Documents\IISExpress\config folder, depending on your OS.

C:\MyApp1.vs\App1\config\ApplicationHost.config

The use of this ApplicationHost.config file is the same as above, but this file will only exist when creating an ASP.NET Web application project.

So what you should edit is the ApplicationHost.config file in the C:\MyApp1\.vs\App1\config path.