ExceptionHandlerServiceCollectionExtensions.AddExceptionHandler Method
Definition
Important
Some information relates to prerelease product that may be substantially modified before it’s released. Microsoft makes no warranties, express or implied, with respect to the information provided here.
Overloads
| AddExceptionHandler(IServiceCollection, Action<ExceptionHandlerOptions>) |
Adds services and options for the exception handler middleware. |
| AddExceptionHandler<TService>(IServiceCollection, Action<ExceptionHandlerOptions,TService>) |
Adds services and options for the exception handler middleware. |
AddExceptionHandler(IServiceCollection, Action<ExceptionHandlerOptions>)
Adds services and options for the exception handler middleware.
public static Microsoft.Extensions.DependencyInjection.IServiceCollection AddExceptionHandler (this Microsoft.Extensions.DependencyInjection.IServiceCollection services, Action<Microsoft.AspNetCore.Builder.ExceptionHandlerOptions> configureOptions);
static member AddExceptionHandler : Microsoft.Extensions.DependencyInjection.IServiceCollection * Action<Microsoft.AspNetCore.Builder.ExceptionHandlerOptions> -> Microsoft.Extensions.DependencyInjection.IServiceCollection
<Extension()>
Public Function AddExceptionHandler (services As IServiceCollection, configureOptions As Action(Of ExceptionHandlerOptions)) As IServiceCollection
Parameters
- services
- IServiceCollection
The IServiceCollection for adding services.
- configureOptions
- Action<ExceptionHandlerOptions>
A delegate to configure the ExceptionHandlerOptions.
Returns
Applies to
AddExceptionHandler<TService>(IServiceCollection, Action<ExceptionHandlerOptions,TService>)
Adds services and options for the exception handler middleware.
public static Microsoft.Extensions.DependencyInjection.IServiceCollection AddExceptionHandler<TService> (this Microsoft.Extensions.DependencyInjection.IServiceCollection services, Action<Microsoft.AspNetCore.Builder.ExceptionHandlerOptions,TService> configureOptions) where TService : class;
static member AddExceptionHandler : Microsoft.Extensions.DependencyInjection.IServiceCollection * Action<Microsoft.AspNetCore.Builder.ExceptionHandlerOptions, 'Service (requires 'Service : null)> -> Microsoft.Extensions.DependencyInjection.IServiceCollection (requires 'Service : null)
<Extension()>
Public Function AddExceptionHandler(Of TService As Class) (services As IServiceCollection, configureOptions As Action(Of ExceptionHandlerOptions, TService)) As IServiceCollection
Type Parameters
- TService
Parameters
- services
- IServiceCollection
The IServiceCollection for adding services.
- configureOptions
- Action<ExceptionHandlerOptions,TService>
A delegate to configure the ExceptionHandlerOptions.