简体   繁体   English

根文件夹中是否可以有多个Web.Config文件

[英]Can there be multiple Web.Config files in root folder

We can configure the settings for the webpages in a particular folder by keeping single web.config. 我们可以通过保留单个web.config来配置特定文件夹中的网页设置。 Can there be multiple web.config in a same hierarchy as i saw some where web.config.debug and web.config.release and web.config . 可以在同一层次结构中存在多个web.config,就像我在web.config.debugweb.config.release以及web.config中看到的那样。 Why they are intended for. 为什么他们的目的。

Those are web.config transformations , which allow you to apply changes to different builds of your project (debug, dev, release, etc). 这些是web.config转换 ,允许您将更改应用于项目的不同构建(调试,开发,发布等)。

The ones suffixed with .debug , .release , etc, are the transformation files. 后缀为.debug.release等的是转换文件。 They take the base web.config and modify it using the XML-Document-Transform attributes you specify. 它们使用基本web.config并使用您指定的XML-Document-Transform属性对其进行修改。

A classic use case is the debug=true attribute, which you never want to use in production. 一个经典的用例是debug=true属性,您永远不想在生产中使用它。 You can use a simple transformation to remove it in your web.config.release file: 您可以使用简单的转换将其删除到web.config.release文件中:

Web.config Web.config文件

<configuration>
    <compilation debug="true" />
</configuration>

Web.config.release Web.config.release

<configuration>
    <compilation xdt:Transform="RemoveAttributes(debug)" />
</configuration>

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM