To output your .NET Core or .NET 5+ errors to a disk file you will need to set the stdoutLogEnabled and stdoutLogFile attributes within the web.config
In your web.config you will need to update the aspNetCore attribute to look similar to below by adding the attributes in bold:
<?xml version="1.0" encoding="utf-8"?>
<configuration>
<location path="." inheritInChildApplications="false">
<system.webServer>
<aspNetCore processPath="dotnet" stdoutLogEnabled="true" stdoutLogFile=".\logs\stdout" hostingModel="inprocess">
</aspNetCore>
</system.webServer>
</location>
</configuration>
You can read more about this in the Microsoft Documentation here