3
votes

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
Regarding this question, I hope my answer is helpful to you.^-^Jason Pan
I'd also like to know since I'm using web.config to enable double escape sequencing in the URL. Azure App Service doesn't expose that capability in the Configuration page.Alex. A

2 Answers

1
votes
 <ItemGroup>
     <Content Update="Configuration\web.config">
       <Link>%(Filename)%(Extension)</Link>
       <CopyToOutputDirectory>Always</CopyToOutputDirectory>
       <CopyToPublishDirectory>Always</CopyToPublishDirectory>
     </Content>
 </ItemGroup>

For more details, you can refer to the content of these two websites.

1、 https://github.com/dotnet/websdk/issues/564

2、 https://developercommunity.visualstudio.com/content/problem/162961/aspnet-core-app-with-a-webconfig-cannot-use-iis-ex.html

1
votes

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