Hide the IIS errors when a .NET Core app can't start

dsbdev 1 Reputation point
2021-05-26T15:16:33.483+00:00

We have a .NET Core 5 Web Api hosted in IIS. I understand that under certain conditions (internal to our app), the process will fail to start.

In such cases, we get a detailed error page from IIS that the application failed to start. Security reviews frown on such information being disclosed. There are many controls in place for not showing "detailed error pages" in ASP.NET, are there any similar controls for .NET Core apps hosted in IIS?

ASP.NET Core
ASP.NET Core
A set of technologies in the .NET Framework for building web applications and XML web services.
4,209 questions
{count} votes

2 answers

Sort by: Most helpful
  1. Duane Arnold 3,216 Reputation points
    2021-05-26T21:44:18.343+00:00

    @dsbdev

    And why can't the program start? And is there an exception being thrown? And this is a WebAPI program, a Web service, you are talking about?


  2. Duane Arnold 3,216 Reputation points
    2021-05-27T14:26:16.07+00:00

    I don't see why you can't implement global exception handling and logging that can be invoked during WebAPI start up in Startup.cs

    https://stackify.com/csharp-catch-all-exceptions/

    Below is WebAPI implementing GEH and logging with Serilog and the ErrorHandlngFilter.cs stating at Program.cs

    https://github.com/darnold924/PubCompanyCore3.x/tree/master/WebApi

    0 comments No comments