Azure App Service -- Web.config changes being overwritten

Viewed 1759

I have made changes to the web.config via Kudu for a .NET core 3.0 application running on Azure App Service, yet it seems when the site is deployed via Azure pipelines those changes I've made within the web.config is overwritten.

Our solution (.sln) doesn't include or have a web.config file.

Am I meant to explicitly include a web.config within our project and then that wouldn't occur?

Thanks for any help

2 Answers

Yes you need to have web.config file in root directory. I had to put web.config for a angular app on app service. Also, using the web.config values in App Service is not recommended. Use the Configuration link on app service (see screenshot below) to store app settings and connection strings. The values in app service configuration override the ones specified in web.config file. This way you keep your config values for different env separate and manageable. If you still want to use web.config values, you can have web.config transform in your solution to transform web.config for different envs. That way you can control the values for different env and have it versioned automatically as it would be part of your code repo. Hope that makes sense. Follow this link for web.config transformation.

enter image description here

Related