开发者

How to use appcmd to set debug=false in IIS7

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/APPHOS开发者_JAVA百科T/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!


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)


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.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜