Makilll
Makilll

Reputation: 83

ASP.NET Core app on IIS - where are the error stack traces logged?

I have published an ASP.NET Core app to IIS on Windows Service 2016. The problem is that I cannot find where are stored error logs, i.e. in my app I got 500 internal server error I want to know where is detailed stack trace of this error in logs on the server. Do I have to configure something to enable logging error details?

I will be very grateful for any help.

Upvotes: 0

Views: 3234

Answers (1)

Chris Pratt
Chris Pratt

Reputation: 239250

Generally speaking, you want to look here: https://learn.microsoft.com/en-us/aspnet/core/host-and-deploy/iis/troubleshoot?view=aspnetcore-2.2#troubleshoot-app-startup-errors

To enable trace logging, you need to modify your web.config:

<aspNetCore ...>
  <handlerSettings>
    <handlerSetting name="debugLevel" value="file" />
    <handlerSetting name="debugFile" value="c:\temp\ancm.log" />
  </handlerSettings>
</aspNetCore>

Alternatively, you can simply run the app from the command line by opening a command prompt to your site directory and running:

dotnet MyApp.dll

You'll be able to see any exceptions raised and their stack traces in the command prompt window.

Upvotes: 1

Related Questions