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?
Hide the IIS errors when a .NET Core app can't start
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?
2 answers
Sort by: Most helpful
-
-
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