Is it possible to share the web.config across multiple projects in a solution?(ASP.NET)

后端 未结 3 864
执笔经年
执笔经年 2020-12-02 02:01

I have a solution composed of a web application and multiple projects, is it possible to share the configuration in the web application across all the solution?

Than

3条回答
  •  独厮守ぢ
    2020-12-02 02:44

    Web.config files contain cascading overrides of a higher web.config file settings. So if you would place a web.config in the root of IIS or adjust settings in the machine.config or standard web.config of the .NET framework (C:\Windows\Microsoft.NET\Framework\v2.0.50727\CONFIG for example).

    The best example's probably the use of the LocalSqlServer connection string. It's defined in the machine.config as

    
        
    
    

    If you would use the Login control for example and would debug and request the connectionstrings then this one will be included as well.

    So if you need some settings common to multiple applications place them in a web.config file which is high enough in the hierarchy, ultimately in the machine.config.

提交回复
热议问题