Override web.config in ASP.NET sub-application
IIS 7 .NET 4.0 I have a website with 4 sub-web-applications. 3 of them need settings from the parent-web.config One should have a completely independent web.config (no inheritance) I am aware of the possibility to turn off inheritance for sub-apps. But what I need is a way to turn it off for only one sub-app! (without having to each section individually.. So I am looking for somet开发者_开发知识库hing like a "dontInheritParentConfig" setting in my sub-web.config
Thank you!
In .net 4 you can use Web.config Transformation Syntax for Web Application Project Deployment. This is a templating change to web.config to allow the file to be different in different scenarios - which should fit with your sub application need.
Web.config files typically include settings that have to be different depending on which environment the application is running in. For example, you might have to change a database connection string or disable debugging when you deploy a Web.config file. For Web application projects, ASP.NET provides tools that automate the process of changing (transforming) Web.config files when they are deployed. For each environment that you want to deploy to, you create a transform file that specifies only the differences between the original Web.config file and the deployed Web.config file for that environment.
精彩评论