asp.net - 无法将 Hangfire 安装到我现有的项目中

标签 asp.net hangfire

我有一个现有的 ASP.NET 项目,但它不在 MVC 中。当我尝试安装 Hangire 时,出现此错误。

PM> Install-Package Hangfire
Attempting to gather dependency information for package 'Hangfire.1.5.8' with respect to project 'FYMAS', targeting '.NETFramework,Version=v4.0'
Attempting to resolve dependencies for package 'Hangfire.1.5.8' with DependencyBehavior 'Lowest'
Resolving actions to install package 'Hangfire.1.5.8'
Resolved actions to install package 'Hangfire.1.5.8'
Adding package 'Newtonsoft.Json.5.0.1' to folder 'C:\Users\User\Desktop\hang\packages'
Added package 'Newtonsoft.Json.5.0.1' to folder 'C:\Users\User\Desktop\hang\packages'
Added package 'Newtonsoft.Json.5.0.1' to 'packages.config'
Successfully installed 'Newtonsoft.Json 5.0.1' to FYMAS
Install failed. Rolling back...
Package 'Hangfire.Core.1.5.8 : Newtonsoft.Json [5.0.0, ), Owin [1.0.0, )' does not exist in project 'FYMAS'
Removed package 'Newtonsoft.Json.5.0.1' from 'packages.config'
Package 'Hangfire.Core.1.5.8 : Newtonsoft.Json [5.0.0, ), Owin [1.0.0, )' does not exist in folder 'C:\Users\User\Desktop\hang\packages'
Removing package 'Newtonsoft.Json.5.0.1' from folder 'C:\Users\User\Desktop\hang\packages'
Removed package 'Newtonsoft.Json.5.0.1' from folder 'C:\Users\User\Desktop\hang\packages'
Install-Package : Could not install package 'Hangfire.Core 1.5.8'. You are trying to install this package into a project that targets '.NETFramework,Version=v4.0', but the package 
does not contain any assembly references or content files that are compatible with that framework. For more information, contact the package author.
At line:1 char:1
+ Install-Package Hangfire
+ ~~~~~~~~~~~~~~~~~~~~~~~~
    + CategoryInfo          : NotSpecified: (:) [Install-Package], Exception
    + FullyQualifiedErrorId : NuGetCmdletUnhandledException,NuGet.PackageManagement.PowerShellCmdlets.InstallPackageCommand

我尝试使用Install-Package Owin命令将owin安装到我的项目中,安装成功,但是当我再次尝试安装hanfire时,出现了相同的错误。我尝试使用 Install-Package HangFire -Version 1.4.6 安装旧版本的 Hangfire,但遇到了相同的错误。

最佳答案

看来你的问题是你的.NET框架,你使用的是4.0,那么你应该为你的框架安装hangfire,试试这个

Install-Package Hangfire_net40

当您使用Install-Package Hangfire时,这将安装最新的稳定版本(在您的情况下为Hangfire.1.5.8,这需要更新的.net框架〜4.5)。欲了解更多详情, Hangfire (.Net 4.0) 1.1.1

关于asp.net - 无法将 Hangfire 安装到我现有的项目中,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/38116356/

相关文章:

c# - 从 Hangfire 作业中获取 UserManager

asp.net - 在 ASP.NET 中缓存链接页面

c# - Hangfire 单实例重复作业

c# - Hangfire 加载程序集失败

javascript - 将值数据库传递给 Javascript

hangfire - 排队和处理后台作业时出现内存不足异常

sql-server - Hangfire Server 是否有权访问应用程序内的敏感数据?

c# - c#中的汇编是什么意思

c# - HttpListener 问题

jQuery.fn.dataTable 未定义