Asp.net Web.config:在xml属性中添加注释
我想在Asp.net Web.config:在xml属性中添加注释,asp.net,web-config,xml-comments,Asp.net,Web Config,Xml Comments,我想在web.config文件中添加一条注释,如下所示: <httpRuntime requestValidationMode="2.0" // require for [ValidateInput(false)] in .net-4.0 requestPathInvalidCharacters="" // include & character in the url enableVersionHeader="false" // disable
web.config
文件中添加一条注释,如下所示:
<httpRuntime
requestValidationMode="2.0" // require for [ValidateInput(false)] in .net-4.0
requestPathInvalidCharacters="" // include & character in the url
enableVersionHeader="false" // disable X-AspNet-Version header
/>
有没有任何方法可以这样添加注释,使用服务器端注释,如
或其他什么?您可以对web.config的任何部分进行注释,以了解如何操作
无论如何
<httpRuntime
requestValidationMode="2.0" <!-- require for [ValidateInput(false)] in .net-4.0-->
requestPathInvalidCharacters="" <!--include & character in the url-->
enableVersionHeader="false" <!-- disable X-AspNet-Version header-->
/>
enableVersionHeader=“false”
/>
web.config文件是一个XML文件,因此您唯一的选择是使用XML注释:
<!--
requestValidationMode="2.0" - require for [ValidateInput(false)] in .net-4.0
requestPathInvalidCharacters="" - include & character in the url
enableVersionHeader="false" - disable X-AspNet-Version header
-->
<httpRuntime
requestValidationMode="2.0"
requestPathInvalidCharacters=""
enableVersionHeader="false"
/>
这在XML中无效。注释不能位于属性区域中。这就是为什么我问可能有一个秘密的服务器端注释类型。缺乏这样做的能力是为什么我越来越认为xml不是复杂配置文件的正确格式。我认为yaml可能是未来的发展方向——它有一种xml所缺乏的优雅的简单性。