IIS 7 .NET 4.0 我有一个包含 4 个子 Web 应用程序的网站。 其中 3 个需要来自parent-web.config 的设置 应该有一个完全独立的web.config(无继承) 我知道可以关闭子应用程序的继承。 但我需要的是一种只为一个子应用程序关闭它的方法! (无需单独每个部分.. 所以我正在我的子 web.config 中寻找类似“dontInheritParentConfig”设置的内容
谢谢!
最佳答案
在.net 4中您可以使用Web.config Transformation Syntax for Web Application Project Deployment 。这是对 web.config 的模板更改,以允许文件在不同场景中有所不同 - 这应该适合您的子应用程序需求。
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.
关于asp.net - 覆盖 ASP.NET 子应用程序中的 web.config,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/6281859/