I am publishing an ASP.NET Core web API to an Azure App Service. I've published from Visual Studio 2022 and from an Azure DevOps pipeline. I'm trying to understand why the Visual Studio publish process is resulting in a different web.config file than the Azure DevOps pipeline.
My project does contain a web.config file with some request limits in it.
<?xml version="1.0" encoding="utf-8"?>
<configuration>
<system.webServer>
<security>
<requestFiltering>
<requestLimits maxAllowedContentLength="52428800" />
</requestFiltering>
</security>
</system.webServer>
</configuration>
When I publish from either Visual Studio or DevOps, the publishing process adds the handler information for the aspNetCore module and an <aspNetCore>
element.
<handlers>
<add name="aspNetCore" path="*" verb="*" modules="AspNetCoreModuleV2" resourceType="Unspecified" />
</handlers>
<aspNetCore processPath=".\DocRecService.exe" stdoutLogEnabled="false" stdoutLogFile=".\logs\stdout" hostingModel="inprocess" />
When I publish from Visual Studio the stdoutLogFile
location on the <aspNetCore>
element is "\\?\%home%\LogFiles\stdout"
.
When I build and publish from the DevOps pipeline the stdoutLogFile
location is .\logs\stdout
.
I believe it's the dotnet publish
task in the pipeline that is transforming the web.config file adding the aspNetCore modile information. I am passing it the following arguments to produce a self-contained app --configuration Release --runtime win-x64 --output $(Build.ArtifactStagingDirectory)
.
The web.config documentation states:
When an app is deployed to Azure App Service, the stdoutLogFile path is set to \?%home%\LogFiles\stdout.
But I can't find any explanation what is/should be setting the value. What is setting the value? How can I mimic that behavior in my Azure DevOps pipeline or outside of Visual Studio? Is it something in the publishing profile which is not being used by the DevOps pipeline? My main goal is just to gain a better understanding of the process.