开发者

Why does a nested ASP.NET 4.0 web.config occasionally cease to inherit?

Given a web application with the following structure:

Main Site (/)
    web.config (root; appSetting="rootSetting")
    Applications (/Applications)
        App1 (/Applications/App1)
            web.config (app1; appSetting="app1Setting")

Inside the application, mo开发者_Python百科st of the time I can obtain both the "rootSetting" and the "app1Setting" via WebConfigurationManager.AppSettings[] and WebConfigurationManager.ConnectionStrings[] static indexers.

However, from time to time, it appears that the App1's web.config does not get loaded. When this occurs, I can get "rootSetting" but "app1Setting" returns null.

I am running under Windows Server 2008 R2 / IIS7.5 / ManagedPipelineMode=Classic.


Consider using a settings file, as describing in the answer to this question. It may simplify what you are trying to accomplish.

0

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜