ASP.NET Core Module configuration examples

Programming, error messages and sample code > ASP.NET

Log creation and redirection

To save logs, you must create the logs directory. The ASP.NET Core Module can redirect stdoutand stderr logs to disk by setting the stdoutLogEnabled and stdoutLogFile attributes of theaspNetCore element. Logs are not rotated (unless process recycling/restart occurs). It is the responsibilty of the hoster to limit the disk space the logs consume.

<?xml version="1.0" encoding="utf-8"?>
    Configure your application settings in appsettings.json. Learn more at
      <add name="aspNetCore" path="*" verb="*" modules="AspNetCoreModule" resourceType="Unspecified" />
    <aspNetCore processPath="dotnet" arguments=".\WebApplication1.dll" stdoutLogEnabled="false" stdoutLogFile=".\logs\stdout" forwardWindowsAuthToken="false" />

Setting environment variables

The ASP.NET Core Module allows you specify environment variables for the process specified in the processPath setting by specifying them in environmentVariables child attribute to theaspNetCore attribute.

<aspNetCore processPath="dotnet"
        <environmentVariable name="DEMO" value="demo_value" />