English 中文(简体)
How to use appcmd to set debug=false in IIS7
原标题:
  • 时间:2009-11-13 14:14:14
  •  标签:
  • iis-7
  • 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!

最佳回答

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.





相关问题
session transfer issue from Tomcat to ASP.Net

I am using Tomcat to host JSP and using IIS 7.0 to host aspx (C# + .Net 3.5 + VSTS 2008), and I have some session transfer issue from JSP page to ASPX page. JSP page is in one domain and all other ...

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 ...

Windows User Account that executes only IIS7 Provisions

I have a web application that executes IIS 7 provisions (using Microsoft.Web.Administration.dll) to create our web and ftp sites. When I run this using the administrator account, it works ok. I want ...

Could I get by HttpModule the URL that contains * before?

My web-site is working under ASP.NET 3.5, IIS7, Integrated pipiline mode. My HttpModule is getting request to all resources, including URLs like this: http://my-site.com/address And I would support *...

IIS 7 Http Handler development issue

I am using VSTS 2008 + C# + .Net 3.5 + IIS 7.0 to develop an ASP.Net web site. I want to develop an Http module, which could inspect whether incoming request has some specific http header (e.g. ...

热门标签