How to do web config settings by another service

123 Views Asked by At

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 ?

1

There are 1 best solutions below

0
On

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'