DatabaseDeveloperPageExceptionFilterServiceExtensions.AddDatabaseDeveloperPageExceptionFilter(IServiceCollection) 方法

定义

与 UseDeveloperExceptionPage 结合使用时,这将捕获与数据库相关的异常,这些异常可以通过使用实体框架迁移来解决。 发生这些异常时,将生成 HTML 响应,其中包含有关解决问题的可能操作的详细信息。

public static Microsoft.Extensions.DependencyInjection.IServiceCollection AddDatabaseDeveloperPageExceptionFilter (this Microsoft.Extensions.DependencyInjection.IServiceCollection services);
static member AddDatabaseDeveloperPageExceptionFilter : Microsoft.Extensions.DependencyInjection.IServiceCollection -> Microsoft.Extensions.DependencyInjection.IServiceCollection
<Extension()>
Public Function AddDatabaseDeveloperPageExceptionFilter (services As IServiceCollection) As IServiceCollection

参数

services
IServiceCollection

IServiceCollection用于添加服务的。

返回

IServiceCollection

注解

只应在开发环境中启用此功能。

适用于