I have an ASP.NE开发者_运维百科T 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.
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"
You can use powershell to modify the web.config.
精彩评论