我正在尝试使用APPCMD
根据documentation在debug=false
中设置web.config
。
我使用的具体语法是:
APPCMD SET CONFIG "SITE/VDIR" section:compilation /debug:False /commit:APP
输出
INFO ( section:compilation, timetaken:219, hresult:00000000, objects:1 )
Applied configuration changes to section "system.web/compilation" for "MACHINE/W
EBROOT/APPHOST/SITE/VDIR" at configuration commit path "MACHINE/WE
BROOT/APPHOST/SITE/VDIR"
之后,debug
仍设置为true
。
我已排除该文件只读;我已经使用进程监视器来监视appcmd实际上在正确的位置写入web.config。我的环境是Windows 2008 x64,SP2。
我知道有很多不同的方法可以解决这个问题;不同的配置文件,在xpath,nant等中自己做,但我特别感兴趣的是APPCMD
为什么似乎不起作用,并帮助其他可能也在努力使用该工具的人。谢谢你的帮助!
答案 0 :(得分:2)
我认为这是一个错误或“按设计”。调查过后,我注意到可以添加和修改<compilation />
部分的其他属性(我还没有尝试过)。
例如以下工作就好了:
APPCMD SET CONFIG "SITE/VDIR" section:compilation /batch:False /commit:APP
APPCMD SET CONFIG "SITE/VDIR" section:compilation /defaultLanguage:"c#" /commit:APP
但是当你观察到它时,不可能改变debug
属性。如果您具备该功能,可能值得将此提升为MS Connect网站上的错误:
我还在IIS论坛上提出了一个问题:
<强>更新强>
这已被微软员工确认为问题:
答案 1 :(得分:0)
通过Catherine Shan's answer,“ / debug”是AppCmd.exe的特殊开关,需要将其转义为“ /!debug”。
例如:
APPCMD SET CONFIG "SITE/VDIR" section:compilation /!debug:False /commit:APP
答案是2013年2月21日,但今天对我有帮助,迟到总比没有好。