如何修复:42601:当尝试访问 Hangfire 仪表板时,“值”处或附近出现语法错误

问题描述 投票:0回答:0

我在 .net-6.0 中使用 Hangfire 和 Postgresql 存储并安装这个包:Hangfire.PostgreSql 版本 1.9.10

这是我在 Program.cs 中的代码:

builder.Services.AddHangfire(config => config.UsePostgreSqlStorage(builder.Configuration.GetConnectionString("HangfireConnection")));
builder.Services.AddHangfireServer();

app.UseHangfireDashboard();

这是 webconfig 中我的连接字符串:

    "ConnectionStrings": {
    "HangfireConnection": "Host=db1.motorazmasamin.com;Port=***;Database=Hangfire;Username=***;Password=***"
},

当键入仪表板 URL(http://localhost/hangfire) 时,返回此错误:

{"data":null,"status":-1,"message":"42601: "value" 处或附近的语法错误 位置:59","statusCode":"500"}

Show Error Image in Visual Studio

但是当将连接字符串更改为 SQL Server 并将包更改为 Hangfire.SqlServer 时,它是正确的!

postgresql .net-6.0 hangfire
© www.soinside.com 2019 - 2024. All rights reserved.