为了账号安全,请及时绑定邮箱和手机立即绑定

SQL Server Express 与 Hangfire 连接问题:用户登录失败

SQL Server Express 与 Hangfire 连接问题:用户登录失败

C#
幕布斯7119047 2023-07-09 16:44:55
我正在尝试连接到我的Hangfire service.我的代码Startup.cs如下所示:services.AddHangfire(configuration => configuration            .SetDataCompatibilityLevel(CompatibilityLevel.Version_170)            .UseSimpleAssemblyNameTypeSerializer()            .UseRecommendedSerializerSettings()            .UseSqlServerStorage(Configuration.GetConnectionString("HangfireConnection"), new SqlServerStorageOptions            {                CommandBatchMaxTimeout = TimeSpan.FromMinutes(5),                SlidingInvisibilityTimeout = TimeSpan.FromMinutes(5),                QueuePollInterval = TimeSpan.Zero,                UseRecommendedIsolationLevel = true,                UsePageLocksOnDequeue = true,                DisableGlobalLocks = true            }));        services.AddHangfireServer();根据文档,Hangfire 1.7 必须built ib sql query创建数据库。我从文档中创建默认连接字符串:"HangfireConnection": "Server=.\\sqlexpress; Database=Hangfire; Integrated Security=SSPI;"但是当我运行我的应用程序时,我收到此错误:System.Data.SqlClient.SqlException:'无法打开登录请求的数据库“Hangfire”。登录失败。用户“DESKTOP-FOVJ16Q\Michal”登录失败我的SecuritySQL Server Express 选项卡如下所示:您能告诉我,我可以检查什么来连接我的 SQL Server Express?
查看完整描述

1 回答

?
交互式爱情

TA贡献1712条经验 获得超3个赞

您会发现“Fabian Schneiter”提出的问题与您提出的问题几乎相同 - 并得到了这样的答复:

您需要首先在服务器上创建数据库Hangfire。我明白,hangfire 也会创建数据库,但这是错误的。如果您有 Hangfire 数据库,Hangfire 将创建所有需要的表。

所以我的建议:尝试将数据库创建Hangfire为新数据库 - 然后再次运行代码并查看它是否有效


查看完整回答
反对 回复 2023-07-09
  • 1 回答
  • 0 关注
  • 118 浏览

添加回答

举报

0/150
提交
取消
意见反馈 帮助中心 APP下载
官方微信