在Visual Studio Mac中寻找有关HangFire的帮助。”这是一个可在Windows / IIS上运行的WebAPI项目。
在启动过程中,HangFire被初始化。一旦发生这种情况,我们将尝试设置一个周期性工作。当连接到Windows上的SQL Server 2014或Linux上的SQL Server 2019 CTP时,这将引发异常。
{System.Transactions.TransactionAbortedException: Transaction failed ---> System.ObjectDisposedException: Cannot access a disposed object. Object name: 'SqlDelegatedTransaction'. at System.Data.SqlClient.SqlDelegatedTransaction.GetValidConnection () [0x0000a]…}
连接到Azure SQL时,它返回
{System.NotImplementedException: The method or operation is not implemented. at System.Transactions.Transaction.EnlistPromotableSinglePhase (System.Transactions.IPromotableSinglePhaseNotification promotableSinglePhaseNotification, System.Guid promoterType)
尝试使用HangFire 1.6.8(适用于Windows),1.6.14和1.6.21。
调用BackgroundJob.Enqueue
或RecurringJob.AddOrUpdate
时引发错误。
为简化此操作,我将其实现为简单函数而不是我们的简单函数,该函数也失败了。
例如
BackgroundJob.Enqueue(() => Console.Write("Enqueue"));
任何帮助将不胜感激!
答案 0 :(得分:2)
我找到了解决此问题的方法...我必须下载HangFire的源代码,将项目添加为引用,并将HangFire.SQLServer项目设置为无需“ NETFULL”符号即可进行编译。