简体   繁体   中英

How to do web config settings by another service

I have multiple client and every time when I deployed my web application I have to update web config file for all environment like live, test

so I want to add one service that will do auto write web config using the service for all environment

how can I do that type of configuration that will help to do easy deployment for all client?

I think you can use powrshell to configure environment variable in applicationhost.config on IIS.

For example, if you want to set sites to development,create a powershell script to set environment variable to development. Just execute script in powershell or create a task schedule to auto execute it.(Same to set Production)

appcmd.exe set config "Default Web Site" -section:system.webServer/aspNetCore /environmentVariables.[name='ASPNETCORE_ENVIRONMENT',value='Production'].value:"Development"  /commit:apphost

You can use this command to execute script.

& 'D:\xxx.ps1'

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM