Matthew Jacobs
Matthew Jacobs

Reputation: 4424

Changing web.config from command line

I have an ASP.NET application running under IIS. I'd like to be able to change one of the web.config values in Application Settings. I know it's possible to change it programmatically as described in this answer but I'm wondering if the same thing can be accomplished from the command line.

The IIS 7 Manager allows application settings and connection strings (among other options) to be changed. My hope is there is a way to do the same via the command line for IIS 6 and/or 7.

Upvotes: 5

Views: 6954

Answers (2)

Carlos Aguilar Mares
Carlos Aguilar Mares

Reputation: 13591

You can use AppCmd.exe which is included with IIS 7.0 and above, in fact Configuration Editor in IIS Manager will automatically generate the command line for you, for example here it will set the test key to NewValue for the /TestApp inside Default Web Site:

appcmd.exe set config "Default Web Site/TestApp" -section:appSettings /[key='test'].value:"NewValue"

Upvotes: 6

Steve
Steve

Reputation: 1199

You can use powershell to modify the web.config.

Upvotes: 3

Related Questions