Hangfire VB启动会引发SQL异常 [英] Hangfire VB Startup Throws SQL Exception

查看:73
本文介绍了Hangfire VB启动会引发SQL异常的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

请参见此StackOverflow问题的背景知识. Hangfire对我来说似乎是正确的解决方案,但我无法使其正常工作.我的开发环境是带有SQL 2005的VB2010.不是最新的工具!

See this StackOverflow question for some background. Hangfire looks like the right solution for me but I'm having trouble getting it to work. My development environment is VB 2010 with SQL 2005. Not the latest tools!

Public Sub Configuration(app As IAppBuilder)
    Dim act = Sub(config As IBootstrapperConfiguration)
                  config.UseSqlServerStorage("HangfireDb")
                  config.UseServer()
              End Sub

    app.UseHangfire(act)
End Sub

我从上面的文章中借用了代码,该代码将原始C#代码转换为VB.显然,这段代码可以工作,但是当我运行它时,它会在调用config.UseSqlServerStorage("HangfireDb")时引发SQLException错误,并显示消息列,参数或变量#5:找不到数据类型为datetime2".

I borrowed the code from the article above which translates the original C# code to VB. Evidently, this code works but when I run it, it throws a SQLException error with the message "Column, parameter, or variable #5: Cannot find data type datetime2" at the call to config.UseSqlServerStorage("HangfireDb").

推荐答案

我的开发环境是带有SQL 2005的VB 2010.

找不到数据类型datetime2

这可能是您的问题所在.

This is probably where your issue lies.

快速浏览了Hangfire表的架构,可以看到HangFire.Hash表的ExpireAt列使用datetime2类型.

Had a quick look at the schema of Hangfire tables and can see that HangFire.Hash table uses datetime2 type for the ExpireAt column.

根据线程,Sql Server 2005不支持此类型,因为它只是在Sql Server 2008中引入的.

According to this thread, Sql Server 2005 doesn't support this type, as it has only been introduced in Sql Server 2008.

这篇关于Hangfire VB启动会引发SQL异常的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆