ASP.NET core running in IIS startup error logging

孤者浪人 提交于 2020-07-07 13:54:07

问题


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?


回答1:


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

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


来源:https://stackoverflow.com/questions/49643054/asp-net-core-running-in-iis-startup-error-logging

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!