Why does .NET generate two web.config files in an MVC asp.net application?

后端 未结 6 1743
一整个雨季
一整个雨季 2020-12-05 04:16

I am new in MVC 3. What is the reason to use two web.config files?

\"enter

Wha

6条回答
  •  生来不讨喜
    2020-12-05 05:08

    ASP.NET configuration is stored in web.config files (XML files).

    These files can appear in many directories in an ASP.NET application. They help to configure application behaviour even before after deploying, based on the fact that you can edit them with notepad. Also they keep separated your code and your configuration data.

    Every web.config file applies to to the directory that it exists and ALL the child subdirectories. Web.config files in child directory may be used to override the parent's web.config file.

    You have the option of overriding individual files or directories by using the location element. See LINK

    The settings inheritance rules are as foillows.

    First there is the machine.config file which is located usually in systemroot\Microsoft.NET\Framework\versionNumber\CONFIG\

    In the same directory exists a 'master' web.config file that defines settings for ALL asp.net application that are running in the machine.

    Then come your web.config files that exist in your application.

    More Info:

    ASP.NET configuration overview

    ASP.NET Configuration file hierarchy and inheritance

提交回复
热议问题