hangfire

How do I set up 'connectionString' for a mySQL database for Hangfire?

浪尽此生 提交于 2020-01-23 11:42:15
问题 I'm trying to integrate hangfire into my .NET core web app. I have followed the instructions on the Hangfire quickstart by installing all necessary packages. I also installed an extension called Hangfire MySql and installed the necessary packages for it. Step 1 says to 'Create new instance of MySqlStorage with connection string constructor parameter and pass it to Configuration with UseStorage method:' GlobalConfiguration.Configuration.UseStorage( new MySqlStorage(connectionString)); Also it

How to configure hangfire with ASP.NET to obtain connection string from config file?

我们两清 提交于 2020-01-21 09:42:05
问题 Please forgive me this probably stupid question, I am still not too familiar with the ASP.NET architecture in general. I inherited a large project, and I intend to setup hangfire.io. I understand that I have to somehow initialize the DB context, but I do not want to hardcode it as suggested by the hangfire-docu. My API\Global.asax.cs currently looks as follows, the interesting stuff begins after // Hangfire stuff : using System.Web.Http; using System.Web.Http.ExceptionHandling; using System

Hangfire FileNotFoundException: Could not load file or assembly DynamicProxyGenAssembly,

倖福魔咒の 提交于 2020-01-05 04:19:27
问题 I am having an issue with HangFire after i set a background job it get set but when i open the HangFire dashboard i see the following exception System.IO.FileNotFoundException: Could not load file or assembly 'DynamicProxyGenAssembly2, Version=0.0.0.0, Culture=neutral, PublicKeyToken=null' or one of its dependencies. The system cannot find the file specified. All interfaces are being registered using AutoFac for DI. , I am setting up the following in the startup.cs I have the following code

User already has more than 'max_user_connections' active connections HANGFIRE

时光毁灭记忆、已成空白 提交于 2020-01-03 02:21:06
问题 I understand User already has more than 'max_user_connections' active connections has already many answers. But this is in regard to Hangfire. I am using Hangfire for background processing. It worked fine for the first time and only when I started my application. But now its not. SO now when I am trying to open the database to see what's happening it gives me this error. My idea is that it cannot execute any more items in the queue because it cannot connect to the database. Also, I cannot

Hangfire Background Job with Return Value

我是研究僧i 提交于 2020-01-02 00:59:23
问题 I'm switching from Task.Run to Hangfire. In .NET 4.5+ Task.Run can return Task<TResult> which allows me to run tasks that return other than void . I can normally wait and get the result of my task by accessing the property MyReturnedTask.Result Example of my old code: public void MyMainCode() { List<string> listStr = new List<string>(); listStr.Add("Bob"); listStr.Add("Kate"); listStr.Add("Yaz"); List<Task<string>> listTasks = new List<Task<string>>(); foreach(string str in listStr) { Task

Recycle of App Pool kills Kestrel but does not restart

假装没事ソ 提交于 2020-01-01 13:15:12
问题 Background When hosting a (non-Core) ASP.net site on IIS 8+ it is possible to utilize the IIS Application Initialization Module to pro-actively initialize ('warm-up') a web application when IIS starts up (or, I believe, when an app pool is recycled). As far as I know, this is not possible when hosting a .net Core app on IIS. I have also noticed that when hosting a .net Core (1.1) app on IIS, the dotnet.exe process (Kestrel) is killed as part of an application pool recycle event. This process

Hangfire server unable to pick job in case of strategy design pattern

守給你的承諾、 提交于 2019-12-29 08:02:09
问题 I am having following application : 1) Mvc app : Hangfire client from where i will just enqueue jobs and host dashboard.This app will contains reference of my class library. 2) Console App : Hangfire server will live in this console application. 3) Class library : Shared library between hangfire server(Console app) and hangfire client(asp.net mvc) where my long running code will reside.Hangfire server will execute code of this library. I am having structure like below in Class library

【netcore入门】在Windows IIS上部署.NET Core 2.1项目

北战南征 提交于 2019-12-27 07:30:48
部署之前先检查下面2个先决条件是否满足 1、安装了 IIS 模块 win7 在 控制面板→程序和功能→打开或关闭Windows功能→勾选Internet 信息服务(Internet Information Services)安装IIS功能 win server 控制面板→程序和功能→打开或关闭Windows功能→添加角色和功能→下一步选择web服务器(IIS)→勾选安装即可 2、安装了 AspNetCoreModule 托管模块 检查 Internet 信息服务(IIS)管理器 服务器的模块里面有没有 托管模块 如果没有点击下面的链接下载安装 这个是netcore2.1版本 https://pan.baidu.com/s/1AUWntFGHlFYqaWa7aNi9YA 安装完之后最好重启一下系统 3、前两个条件都满足之后,就可以部署IIS站点了,跟平时部署站点的唯一区别就是 应用程序池,选择【无托管代码】,其他基本和 .net 一模一样 解决方案的发布就不再描述了 按照上面两步操作之后依然不能正常访问的话 可以配置下 web.config 里的日志输出目录,跟踪日志查找原因 这里有一个坑需要注意一下,就是日志输出的目录默认是 logs 文件夹下面的,但是它又不会自动创建这个logs目录,简直就是sb操作 所以修改下目录为程序当前目录(.\)即可,然后将目录开关

MVC中使用Hangfire执行定时任务

孤人 提交于 2019-12-26 11:59:57
需求描述 项目中有一个通知公告的功能,在后台管理员添加公告后需要推送消息给所有注册用户,让其查看消息。消息推送移动端采用极光推送,但是消息在何时发送是个问题,比如说有一个重要的会议通知,可能希望在会议开始前半天进行提醒,仅仅使用后台代码处理起来可能比较麻烦,这时就需要考虑到使用作业来处理这种定时执行的业务。 在NET平台,作业有很多方式,可以diy一个系统作业,或者使用数据库的作业功能写一个定时执行,再有一种方案就是使用外部开源的定时任务系统来完成。 首先来说,采用系统DIY作业的方式。在不同平台上都有相应的命令来支持这一操作,完成起来也不是很难,但是这样的话应用程序会和系统高耦合,万一想换系统或者换服务器,作业内容直接丢失,再者如果搞不好维护起来也比较麻烦。所以这个pass掉了 再者说数据库,各大数据库也都支持作业功能,sql server 或者mysql等。同样面临的问题 第一,不同数据库命令不一致;第二,添加了作业以后在数据库调整,比如数据库服务迁移会导致作业中断;还有一点,数据库作业如果做定时数据更新,数据库备份是比较不错的选择,都在持久层层面,与业务无关。但是如果牵扯到业务,那就有些麻烦了,想象一下,数据库定时执行了一个邮件发送的任务,生成了一条邮件的记录,然后通知IIS相关进程发送邮件,很有些本末倒置的感觉。 前两者其实各有各的使用场景,还是那句话,技术没有好坏

Hangfire Cron expressions are not valid

荒凉一梦 提交于 2019-12-25 16:55:54
问题 I am using Hangfire and I want to describe different scenarios for my RecurringJobs. But I am not being able to achieve what I am looking for, and if CRON is already limited, the CRON used by Hangfire is yet more. I went on reading Hangfire documentation and I find a like to https://en.wikipedia.org/wiki/Cron#CRON_expression for more complex expressions then the ones supported by default on Hangfire. But they are not even compatible, for instance, Hangfire only has minutes, hour, month, day,