gpt4 book ai didi

c# - Hangfire 显示在同一台服务器上运行的两个实例 v.1.5.3 - 导致错误

转载 作者:可可西里 更新时间:2023-11-01 14:42:36 24 4
gpt4 key购买 nike

我已遵循指定的文档 here使应用程序始终运行并启用服务自动启动。对于配置,我使用了指定的文档 here在此应用程序中,我使用的是 Hangfire 1.5.3 版。我在同一台服务器上运行了另外两个 Hangfire 应用程序,一个使用 Hangfire v.1.4.1,另一个使用 1.4.5。这两个都可以完美地工作。每个应用程序都在它自己的应用程序池下运行,并且代码没有区别。

无法运行的应用程序会在端口号后添加一个 GUID,如下图所示。此应用程序有时不会自动启动,我认为这与两个服务器实例有关。

我知道 Hangfire 已经用 ServerName 修改了一些东西,因为如果你使用“BackgroundJobServerOptions”和“ServerName”变量,你会得到过时的消息:

"Server Id is auto-generated now, and this option does not make sense anymore. Will be removed in 2.0.0."

有没有人遇到过这个问题并设法解决了?

注意:我没有在任何应用程序中使用 BackgroundJobServerOptions,我已尝试重新启动服务器。

enter image description here

工作的两个应用程序:

enter image description here

enter image description here

最佳答案

发现问题。似乎在版本 1.5.3 中,可能是 1.5 <,如果您也在 Global.asax 中注册了应用程序启动,则不应在 OWIN 启动类中使用 app.UseHangfireServer()。当我注释掉下面的代码时,一切都重新开始工作。

public partial class Startup
{
public void Configuration(IAppBuilder app)
{
ConfigureAuth(app);

//GlobalConfiguration.Configuration.UseSqlServerStorage("DefaultConnection");
//app.UseHangfireServer();
}
}

更新:

我正在学习本教程:

http://docs.hangfire.io/en/latest/deployment-to-production/making-aspnet-app-always-running.html

Global.asax.cs:

protected void Application_Start(object sender, EventArgs e)
{
HangfireBootstrapper.Instance.Start();
}

protected void Application_End(object sender, EventArgs e)
{
HangfireBootstrapper.Instance.Stop();
}

关于c# - Hangfire 显示在同一台服务器上运行的两个实例 v.1.5.3 - 导致错误,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/34897545/

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