gpt4 book ai didi

asp.net-core-2.0 - UseHangfireServer 抛出异常

转载 作者:行者123 更新时间:2023-12-02 09:15:51 27 4
gpt4 key购买 nike

我的 ASP.NET Boilerplate Core 2.0 应用程序有问题。

我在应用层做了很多工作,现在我想尝试 MVC 项目中的代码。但是,当我尝试启动应用程序时,出现以下错误:

System.InvalidOperationException: 'Unable to find the required services. Please add all the required services by calling 'IServiceCollection.AddHangfire' inside the call to 'ConfigureServices(...)' in the application startup code.'

此错误发生在第 (102) 行:app.UseHangfireServer();

我不知道hangfire有什么问题。我没有更改 startup.cs 文件中的代码。

最佳答案

这是错误消息告诉您的操作:

services.AddHangfire(config =>
{
config.UseSqlServerStorage(_appConfiguration.GetConnectionString("Default"));
});

the line 上添加以上内容之前:

services.AddScoped<IWebResourceManager, WebResourceManager>();

关于asp.net-core-2.0 - UseHangfireServer 抛出异常,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/47226046/

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