postgresql - 为什么 HangFire 启动过程失败并出现此错误?

标签 postgresql hangfire

我们在启动使用 HangFire (1.6.22) 和 PostgreSQL 的进程时看到此错误。

2019-03-19 00:12:45,406 [1] ERROR
Hangfire.PostgreSql.PostgreSqlStorage [(null)] - Error while executing install/upgrade Npgsql.PostgresException (0x80004005): 42701: column "updatecount" of relation "lock" already exists
    at Npgsql.NpgsqlConnector.<>c__DisplayClass161_0.<<ReadMessage>g__ReadMessageLong|0>d.MoveNext()
--- End of stack trace from previous location where exception was thrown ---
    at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()
    at Npgsql.NpgsqlConnector.<>c__DisplayClass161_0.<<ReadMessage>g__ReadMessageLong|0>d.MoveNext()
--- End of stack trace from previous location where exception was thrown ---
    at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task)
    at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
    at System.Runtime.CompilerServices.TaskAwaiter`1.GetResult()
    at Npgsql.NpgsqlDataReader.<NextResult>d__46.MoveNext()
--- End of stack trace from previous location where exception was thrown ---
    at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task)
    at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
    at Npgsql.NpgsqlDataReader.NextResult()
    at Npgsql.NpgsqlCommand.<ExecuteDbDataReader>d__100.MoveNext()
--- End of stack trace from previous location where exception was thrown ---
    at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task)
    at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
    at Npgsql.NpgsqlCommand.<ExecuteNonQuery>d__92.MoveNext()
--- End of stack trace from previous location where exception was thrown ---
    at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task)
    at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
    at System.Runtime.CompilerServices.TaskAwaiter`1.GetResult()
    at Npgsql.NpgsqlCommand.ExecuteNonQuery()

最佳答案

已修复。这可能会帮助其他人,我们所做的。

真正的问题是,当我们为 HangFire 创建表时,它是使用源代码库中可用的 SQL 脚本创建的。当代码运行时,它发现一些不匹配并自动尝试更新数据库表,但失败了。

所以我们删除了所有表,让 HangFire 在第一次运行时创建表。现在工作正常。

关于postgresql - 为什么 HangFire 启动过程失败并出现此错误?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/55237608/

相关文章:

sql - 如何聚合多列的值?

Azure 工具无法读取服务定义文件

mysql - 可替代 MySQL 的嵌入式数据库

sql - 使用 PostgreSQL 区分计数

asp.net-mvc - 如果 Hangfire 已在运行,则停止启动重复作业

hangfire - 如何使用unity配置hangfire?

asp.net-core - 如何重启 Hangfire 服务器,或停止它并启动一个新服务器,以更改它正在处理的队列?

c# - 带依赖注入(inject)的 Hangfire RecurringJob

ruby-on-rails - 使用 STI 时索引去哪里了?

sql - 如何查询构建的字符串选择