开发者

What configuration is not used in a secondary web.config file for an ASP.NET web application?

The ASP.NET web applications that I'm working on is using multiple web.config files. One in the web root folder, and then we have another project (*.csproj) called "admin" which is located in a nested folder und开发者_开发问答er the web root of the application containing its own web.config file. What ASP.NET configuration (or other configuration) is USED (or NOT USED) in the secondary web.config file? I'm in the process of upgrading Telerik's Rad Controls and adding some new features. However, none of these controls apply to the main web application. They all apply to the admin project pages. So I don't want to add something into the main/primary web.config file if I can help it. If you also can share any gotchas (or limitations) when using a secondary web.config, please do!


web.config files are essentially merged through hierachy layout, as all config files are. Consider the following:

machine.config (1)
    -> web.config (2)
         -> applicationHost.config (3)
              -> web.config (4)
                  -> web.config (5) 

The configuration mechanism in .NET allows for configuration elements to be overridden (or locked) at various stages in the configuration hierarchy, where:

  1. machine.config is the machine level configuration - configuration here is applied to all .NET applications.
  2. root web.config is the machine level web configuration - where the majority of ASP.NET modules/handlers are configured, and configuration is applied to all ASP.NET applications.
  3. applicationHost.config is the IIS7 root web configuration - the module/handler configuration items are used when the application pool is running in Integrated mode.
  4. application web.config is the application-level web configuration. Configuration here is applied to the application and all child folders/virtual folders.
  5. virtual folder web.config is the virtual-folder-level web configuration. Configuration here is applied to the current virtual folder and all child folders/virtual folders.

If you are running on IIS <7, or IIS7 in Classic pipeline mode, the applicationHost.config file is not used as part of the merged configuration.

The .NET configuration framework will merge the configurations all the way up hierarchy, obeying overrides and locked configuration elements where necessary.

In you case, I would imagine you need to apply configuration at the virtual-folder level in your IIS application.


Both Web.configs are used. The Web.config file in the root folder will affect everything below it; the Web.config in the sub directory of the root folder, will affect everything below it too. f there are any conflicts between both Web.config files, the application will probably throw an exception (for example if you add application keys with the same value in both Web.config files).

If your Telerik controls will only be used on the project located in the sub directory, then you should add the changes to the Web.config file in that sub directory, not the root.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜