Controllertype inherits fromControllerBaseand have Views supportControllerBasetype is better suited for APIs
Further read:
https://learn.microsoft.com/en-us/aspnet/core/web-api/?view=aspnetcore-6.0
Controller type inherits from ControllerBase and have Views supportControllerBase type is better suited for APIsFurther read:
https://learn.microsoft.com/en-us/aspnet/core/web-api/?view=aspnetcore-6.0
Further read:
https://learn.microsoft.com/en-us/aspnet/core/fundamentals/servers/kestrel?view=aspnetcore-6.0
To handle exceptions on Controller/Action level Exception Filters are used.
[TypeFilter(typeof(SampleExceptionFilter))] public class ExceptionController : Controller
Exception Filters are implemented using IExceptionFilter with OnExcetion method override to handle exceptions.
Exception Filters can be applied to Controller and Action level.
Further read:
To add global exception handling in ASP.NET Core just use configuration method:
app.UseExceptionHandler
Pretty much everything. Default ASP.NET Core request handling pipeline is consisting of bunch of middlewares:
Whole list of built-in middlewares can be found here:
There is possibility to write custom middleware too.