hangfire

关于 hangfire 的权限问题

血红的双手。 提交于 2020-03-07 07:39:07
hangfire 是一个分布式后台执行服务。 官网:http://hangfire.io/ 我看中hangfire的地方是 1:使用简单 2:多种持久化保存方案。支持sqlserver ,msmq等 ,其他的redis 等持久化方案要收费。不过自己扩展不是难事。hangfire基于net3.5的extension扩展。 3:有监控系统,并且可以和其他监控系统集成。 回顾正题: hangfire在部署到iis环境上,通过地址访问的时候会出现401未授权错误。通过代码分析是由于hangfire内建授权机制造成的问题。 在分析源码前,建议先对owin做个了解: http://www.cnblogs.com/dudu/p/what-is-owin.html http://owin.org/ hangfire继承了OwinMiddleware,在每次请求的时候会去执行IAuthorizationFilter的实现。 internal class DashboardMiddleware : OwinMiddleware { private readonly JobStorage _storage; private readonly RouteCollection _routes; private readonly IEnumerable<IAuthorizationFilter>

Hangfire does not process recurring jobs unless dashboard is open

ぃ、小莉子 提交于 2020-02-21 12:01:16
问题 When I log into the server and open dashboard, it shows recurring jobs with the next execution in the past. Within seconds it triggers processes them automatically, but if I don't log in and open the dashboard, the recurring jobs are not triggered. It appears that Hangfire is running as expected and processing jobs. Why will it not trigger without me looking at it? 回答1: It's a usual problem if a Hangfire server runs in a web application . The jobs are not triggered because the web server has

整合了一个命令行程序的框架(1)

笑着哭i 提交于 2020-02-16 10:54:34
接上一篇 整合了一个命令行程序的框架 我增加了一点功能 aop和定时任务 这次更新主要增加了审计日志还有集成了hangfire做定时任务 先来看审计日志部分,审计日志主要是使用了Windsor的动态代理功能.每一个添加了Audited特性的方法或者类,在方法被调用时会输出参数和值.使用时只要在需要审计的service上增加Audited特性即可 ``` [Audited] public class DemoService : LunaServiceBase, IDemoService { public string GetMessage(string name) { Logger.Info($"GetMessage {name}"); return "测试"; } public string GetDemo(DemoModel model) { var msg = $"{model.Name}: {model.Age}"; return msg; } } ``` 同时在start上增加了一个可选参数.目前只有一个设置项,就是是否开启审计日志功能.如果不开启的话,标记了aduited的service也不会输出审计日志 定时任务的用法和之前的还是有一些区别.如要体现在runner上.之前的runner要继承LunaRunnerBase

Dependencies of Hangfire client code at Hangfire Server while executing the job fetched from db

ⅰ亾dé卋堺 提交于 2020-01-30 11:31:10
问题 I am using Hangfire to trigger a task daily. I have made two solutions. One for Hangfire Client and another for Hangfire Server. The task is to make a call to another API. When I run this Hangfire client, it is adding the job to MongoDB Successfully. But when Server solution is ran, It is throwing an error : Could not load file or assembly 'schedulingclient.Web, Culture=neutral, PublicKeyToken=93cadf9107ebec2e'. The system cannot find the file specified. scheduling client is the API and also

Hangfire项目实践分享

走远了吗. 提交于 2020-01-28 10:21:20
Hangfire项目实践分享 目录 Hangfire项目实践分享 目录 什么是Hangfire Hangfire基础 基于队列的任务处理(Fire-and-forget jobs) 延迟任务执行(Delayed jobs) 定时任务执行(Recurring jobs) 延续性任务执行(Continuations) 与quartz.net对比 Hangfire扩展 Hangfire Dashborad日志查看 Hangfire Dashborad授权 IOC容器之Autofac RecurringJob扩展 使用特性 RecurringJobAttribute 发现定时任务 使用json配置文件注册定时任务 与MSMQ集成 持久化存储之Redis Hangfire最佳实践 配置最大job并发处理数 使用 DisplayNameAttribute 特性构造缺省的JobName Hangfire在调用Background/RecurringJob创建job时应尽量使传入的参数简单. 为Hangfire客户端调用定义统一的REST APIs 利用Topshelf + Owin Host将hangfire server 宿主到Windows Service. 日志配置 Hangfire多实例部署(高可用) HF.Samples.Consumer HF.Samples.APIs HF

How to configure Hangfire with Mysql storage

二次信任 提交于 2020-01-25 07:33:05
问题 I have a web app that I developed using ASP.NET CORE and I want to send weekly newsletters to my customers. After looking around, I thought Hangfire will be a good tool for me to use. Unfortunately, I can't seem to get it to work using Mysql database. It works perfectly with the InMemboryStorage. Below is my set up. ASP.NET CORE 2.2 Hangfire 1.7.8 Hangfire.Mysql.Core 2.2.5 Hangfire creates about 9 tables in the database, but when I try creating a background job,. I get an error that says,

Hangfire doesn't create tables in IIS

六月ゝ 毕业季﹏ 提交于 2020-01-25 00:10:07
问题 I have installed Hangfire in my ASP.Core 2.2 project using this guide https://docs.hangfire.io/en/latest/getting-started/aspnet-core-applications.html . When I delete my MyProject_dev MSSQL db and run Update-Database only my custom tables are created. After I run the project, the Hangfire tables are added. In appsettings.production.json I have configured the db to be MyProject_prod and I click on Folder publish with checked Entity Framework Migrations so the build process can create a .sql

Schedule a hangfire job at specific time of the day based on time zone

帅比萌擦擦* 提交于 2020-01-24 22:10:08
问题 In hangfire i can schedule a job to run at a specific time by calling a method with delay BackgroundJob.Schedule( () => Console.WriteLine("Hello, world"), TimeSpan.FromDays(1)); I have a table with following information User Time TimeZone -------------------------------------------------------- User1 08:00:00 Central Standard Time User1 13:00:00 Central Standard Time User2 10:00:00 Eastern Standard Time User2 17:00:00 Eastern Standard Time User3 13:00:00 UTC Given this information, For every

Hangfire jobs not running on my Asp .Net Core-site

ぃ、小莉子 提交于 2020-01-24 19:32:27
问题 To sum up the text below: What do I have to do to run Hangfire jobs when there are no users on my web page? Im running asp net core and have started using Hangfire for recurring tasks on my web application. I left it running on my job for the weekend but when I get back no jobs has been run. After googling a bit I've got that it seems to be a "fix"/method for this on hangfires docs, but it seems to be made for non-core. Do I need a special handling for this in .Net Core (with app

Hangfire jobs not running on my Asp .Net Core-site

邮差的信 提交于 2020-01-24 19:31:58
问题 To sum up the text below: What do I have to do to run Hangfire jobs when there are no users on my web page? Im running asp net core and have started using Hangfire for recurring tasks on my web application. I left it running on my job for the weekend but when I get back no jobs has been run. After googling a bit I've got that it seems to be a "fix"/method for this on hangfires docs, but it seems to be made for non-core. Do I need a special handling for this in .Net Core (with app