I am publishing an asp.net core v3.1 app in visual studio 2019
since core apps do not create a web.config
webdeploy creates it and publishes its own web.config on every publish
while it does that
it sets the stdout=false
and i would like to be true -
anyone know how to control this?
i was toying around with trying to configure something in the .csproj
but never found the correct combination
heres what the published web.config looks like:
<aspNetCore processPath="dotnet" arguments=".\myproj.dll" stdoutLogEnabled="false" stdoutLogFile=".\logs\stdout" hostingModel="InProcess" />
and of course heres what i want it to look like:
<aspNetCore processPath="dotnet" arguments=".\myproj.dll" stdoutLogEnabled="true" stdoutLogFile=".\logs\stdout" hostingModel="InProcess" />
another post about this same issue here:
https://github.com/MicrosoftDocs/azure-docs/issues/31380
\%home%\LogFiles\stdout .
To set the ASPNETCORE_ENVIRONMENT environment variable in Windows: Command line - setx ASPNETCORE_ENVIRONMENT "Development" PowerShell - $Env:ASPNETCORE_ENVIRONMENT = "Development"
You can add a web.config to your poject by right click the project, add=>newItem=>Web=>Web Configuration File.And then you can set stdoutLogEnabled in it.
Example(pay attention you need to add hostingModel="inprocess"
to web.config):
<system.webServer>
<handlers>
<remove name="aspNetCore"/>
<add name="aspNetCore" path="*" verb="*" modules="AspNetCoreModule" resourceType="Unspecified"/>
</handlers>
<aspNetCore processPath="%LAUNCHER_PATH%" arguments="%LAUNCHER_ARGS%" stdoutLogEnabled="true" stdoutLogFile=".\logs\stdout" hostingModel="InProcess"/>
</system.webServer>
And here is the published web.config:
<?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=".\case1(5-26).dll" stdoutLogEnabled="true" stdoutLogFile=".\logs\stdout" hostingModel="inprocess" />
</system.webServer>
</location>
</configuration>
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With