如何在 IIS7 中使用 appcmd 设置 debug=false
我正在尝试使用 APPCMD
在 web.config
中设置 debug=false
,按照 文档。
我使用的具体语法是:
APPCMD SET CONFIG“SITE/VDIR”部分:编译 /debug:False /commit:APP
输出为
INFO (section:compilation, timetaken:219, hresult:00000000, objects:1 ) 将配置更改应用于“MACHINE/W”的“system.web/compilation”部分 EBROOT/APPHOST/SITE/VDIR”位于配置提交路径“MACHINE/WE BROOT/APPHOST/SITE/VDIR"
之后,debug
仍然设置为 true
。
我已经排除了该文件是只读的;我使用了进程监视器观看 appcmd 实际上在正确的位置写入 web.config 我的环境是 Windows 2008 x64,SP2
我知道有很多不同的方法可以解决这个问题,我可以在 xpath、nant 等中执行此操作,但我特别感兴趣的是为什么 APPCMD
似乎不起作用,并帮助其他可能也在使用该工具的人。感谢您的帮助!
I'm trying to use APPCMD
to set debug=false
in web.config
, per the documentation.
The specific syntax I am using is:
APPCMD SET CONFIG "SITE/VDIR" section:compilation /debug:False /commit:APP
the output is
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"
Afterwards, debug
still is set to true
.
I have ruled out the file being read only; I have used process monitor to watch appcmd actually write to web.config in the correct location. My environment is Windows 2008 x64, SP2.
I understand that there are many different ways to solve the problem; different config files, doing it myself in xpath, nant, etc, but I'm specifically interested in why APPCMD
does not seem to be working, and to help others who may also be struggling with the tool. Thanks for your help!
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
我认为这是一个错误或“设计使然”。经过调查后,我注意到可以添加和修改
部分的其他属性(我还没有全部尝试过)。例如以下工作就很好:
但正如您所观察到的,不可能更改
debug
属性。如果您有这种能力,那么可能值得将其作为 MS Connect 站点上的错误提出:我还在 IIS 论坛上提出了一个问题:
更新:
Microsoft 员工已确认这是一个问题:
I think this is a bug or 'by design'. Having investigated this I noticed that it's possible to add and modify other attributes of the
<compilation />
section (I haven't tried them all).For example the following work just fine:
But as you observe it's just not possible to alter the
debug
attribute. It may be worth raising this as a bug on the MS Connect site if you've got that ability:I also popped a question on the IIS forums:
Update:
This has been confirmed as an issue by a Microsoft employee:
根据 Catherine Shan 的回答,“/debug”是一个特殊的开关AppCmd.exe 需要转义为“/!debug”。
例如:
回复帖子是2013年2月21日,但今天对我有帮助,迟到总比不到好。
By Catherine Shan's answer, "/debug" is a special switch for AppCmd.exe and needs to be escaped as"/!debug".
For example:
The answer post is February 21st, 2013, but it helped me today, better late than never.