gpt4 book ai didi

services.AddDatabaseDeveloperPageExceptionFilter(); error code: CS1061(Services.AddDatabaseDeveloperPageExceptionFilter();错误代码:CS1061)

转载 作者:bug小助手 更新时间:2023-10-25 16:57:25 33 4
gpt4 key购买 nike



Code:

代码:


public void ConfigureServices(IServiceCollection services)
{
services.AddDbContext<SchoolContext>(options =>
options.UseSqlServer(Configuration.GetConnectionString("DefaultConnection")));
services.AddDatabaseDeveloperPageExceptionFilter();
services.AddControllersWithViews();
}

Error message:

错误信息:


Error   CS1061  'IServiceCollection' does not contain a definition for 'AddDatabaseDeveloperPageExceptionFilter' 
and no accessible extension method 'AddDatabaseDeveloperPageExceptionFilter' accepting a first argument of type
'IServiceCollection' could be found (are you missing a using directive or an assembly reference?)
AspCore_DB C:\Startup.cs 30 Active

This code is officially introduced in the MS guide and I just followed. I'm working on MS Visual Studio 2019 v16.8.2.

这段代码是在微软指南中正式介绍的,我刚才也跟着读了。我正在开发MS Visual Studio 2019 v16.8.2。


更多回答
优秀答案推荐

After doing some research I found that this is in the Microsoft.AspNetCore.Diagnostics.EntityFrameworkCore library.

在做了一些研究后,我发现它在Microsoft.AspNetCore.Diagnostics.EntityFrameworkCore库中。



guys you can install this package Microsoft.AspNetCore.Diagnostics.EntityFrameworkCore 7.0.10 from -tools -> Nuget Package Manager -> Manage Nuget Package for Solution, this works for me.

伙计们,您可以安装这个包Microsoft.AspNetCore.Diagnostics.EntityFrameworkCore 7.0.10从-工具->Nuget包管理器->管理Nuget包的解决方案,这对我很管用。


更多回答

Sent a note to MS - credit to you @dennis github.com/dotnet/AspNetCore.Docs/issues/22482

发送通知至MS-Credit to You@dennis github.com/dotnet/AspNetCore.Docs/issues/22482

33 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com