如何在 IIS7 中使用 appcmd 设置 debug=false

发布于 2024-08-10 17:39:07 字数 801 浏览 1 评论 0原文

我正在尝试使用 APPCMDweb.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 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(2

羅雙樹 2024-08-17 17:39:07

我认为这是一个错误或“设计使然”。经过调查后,我注意到可以添加和修改 部分的其他属性(我还没有全部尝试过)。

例如以下工作就很好:

APPCMD SET CONFIG“SITE/VDIR”部分:编译 /batch:False /commit:APP
APPCMD SET CONFIG "SITE/VDIR" 部分:编译 /defaultLanguage:"c#" /commit:APP

但正如您所观察到的,不可能更改 debug 属性。如果您有这种能力,那么可能值得将其作为 MS Connect 站点上的错误提出:

Microsoft Connect

我还在 IIS 论坛上提出了一个问题:

可能的错误:无法在“编译”部分设置“调试”属性在 web.config (IIS.NET)

更新:

Microsoft 员工已确认这是一个问题:

回复可能的错误:无法在web.config (IIS.NET) 中的“编译”部分

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:

APPCMD SET CONFIG "SITE/VDIR" section:compilation /batch:False /commit:APP
APPCMD SET CONFIG "SITE/VDIR" section:compilation /defaultLanguage:"c#" /commit:APP

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:

Microsoft Connect

I also popped a question on the IIS forums:

Possible bug: Unable to set the "debug" attribute in the "compilation" section in web.config (IIS.NET)

Update:

This has been confirmed as an issue by a Microsoft employee:

Reply to Possible bug: Unable to set the "debug" attribute in the "compilation" section in web.config (IIS.NET)

在风中等你 2024-08-17 17:39:07

根据 Catherine Shan 的回答,“/debug”是一个特殊的开关AppCmd.exe 需要转义为“/!debug”。

例如:

APPCMD SET CONFIG "SITE/VDIR" section:compilation /!debug:False /commit:APP

回复帖子是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:

APPCMD SET CONFIG "SITE/VDIR" section:compilation /!debug:False /commit:APP

The answer post is February 21st, 2013, but it helped me today, better late than never.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文