Where should web.config be located?

The web.config file is allowed to be at any level of the IIS folders, but for web.config to take effect, the residing directory must be the web root (such as C:\inetpub\wwwroot) or the app base path. If you place the web.config file in a directory which is not a web root or has not been converted to an IIS sub-app (to become an app base path), the web.config file will not take effect.

  • In IIS, the web root is the main directory where the web site's files and folders are stored. It is the base location from which the server serves the web site's content (such as web.config, ServerAPIs.exe etc.). The web.config file in the web root contains configurations used by the web site, such as the file to launch when the web site URL is run.

  • The app base path is the root directory of an application hosted within IIS. It is the location from which the application's files (such as web.config, ServerAPIs.exe etc.) and resources are served. The web.config file in the app base path contains configurations used by the specific app only, such as the file to launch when the sub app URL is run. Multiple sub apps can be hosted under the same web root, and each sub app can have its own app base path and web.config file.

Note

Multiple web.config files can exist in different folders of the same web site. The setting inheritInChildApplications="false" in the web.config file indicates that the settings for the web site will not be inherited by sub-apps.