Reputation: 12423
I have a dotnet core 3.1 app deployed to Azure App Service and I want to set the web.config's stdoutLogEnabled
value to true
once the deployment is complete. I've decided to do this using the Deploy Azure App Service
step's inline Post Deployment Action
.
The problem is that I don't know how to reference the web.config file in the correct location. What is the environment path to use to target the web.config file in the released folder?
Upvotes: 2
Views: 3641
Reputation: 571
You can add a web.config file at the base folder of your dotnet core app or api and then on publishing the application it will be updated in Azure App service or any IIS server where you publish.
<?xml version="1.0" encoding="utf-8"?>
<configuration>
<location path="." inheritInChildApplications="false">
<system.webServer>
<handlers>
<add name="aspNetCore" path="*" verb="*" modules="AspNetCoreModuleV2" resourceType="Unspecified" />
</handlers>
<aspNetCore processPath="dotnet"
arguments=".\MyApp.dll"
stdoutLogEnabled="false"
stdoutLogFile=".\logs\stdout"
hostingModel="inprocess" />
</system.webServer>
</location>
</configuration>
If a web.config file isn't present in the project, the file is created with the correct processPath and arguments to configure the ASP.NET Core Module and moved to published output.
Reference - MS Docs
Upvotes: 0
Reputation: 1743
There is no web.config in ASP.Net app , web.config is generated automatically after publishing the project. If you want you can add
Right click on Application folder -->Add new Item --> web.config.
To check your web.config file after Publishing the application.
Go to Azure portal , Open your Web App -->Development Tools -- >Console Run ls command to check the existing files. Run cat.web.config command, web.config file code will be displayed.
To Edit the web.config, download WinSCP_Setup.exe file from google and Install. Enter the Hostname , username and password from the azure portal.
Go to Deployment Center -- > FTP Credentials Copy the Required Hostname (FTPS endpoint), username and Password and paste in WinSCP Setup. In right side pane of WinSCP you will find the files of your deployed application. You can open it and edit accordingly.
Upvotes: 1