ubi
ubi

Reputation: 4399

ASP.NET core running in IIS startup error logging

How do you capture startup errors in an ASP.NET Core app hosted in IIS? I'm trying to capture exceptions thrown in ConfigureServices which occurs only in the IIS hosted environment.

I came across this as a certificate file loaded in ConfigureServices was missing and it was not captured without writing to a different log file than the application log file configured through log configuration (note that the logging system doesn't get initialised before ConfigureServices). In this case stderr would contain the exception but does IIS capture it and log it somewhere?

Upvotes: 2

Views: 4599

Answers (1)

Set
Set

Reputation: 49779

ASP.NET Core module for IIS has stdoutLogEnabled and stdoutLogFile optional parameters:

<aspNetCore processPath="dotnet" 
            arguments=".\MyApp.dll" 
            stdoutLogEnabled="true" 
            stdoutLogFile=".\logs\stdout" />

Upvotes: 3

Related Questions