SIL.HangfireHttpJob
前端:
后端:
启动项目:
系统配置文件:

{
"hangfire.server.serviceAddress": "http://localhost:9006/",
"hangfire.server.website": "https://hr.sunstronggroup.com",
"hangfire.login.user": "admin",
"hangfire.login.pwd": "lQTk1LPfobhPJD8xx1bOag==",
"hangfire.UseRedis": false,
"hangfire.UseMySql": false,
"hangfire.UseSqlServer": true,
/*是否使用邮件通知*/
"hangfire.UseEmail": false,
/*是否使用apollo配置*/
"hangfire.UseApollo": false,
/*后台进程,支持长时间运行的任务*/
"UseBackWorker": false,
/* Apollo服务器配置*/
"apolloserver": {
"AppId": "jobserver-Jp-XA-1",
"MetaServer": "http://localhost:8080"
},
"ConnectionStrings": {
//正式数据库(26)
"hangfire.sqlserver": "Yz4Hb1mO4rC5p6kx8XuobSRRiHoArqtb70aHkTSx913LpeNWYmGh/Ksk9jHwbun4URvU0PIGSt2pLNVykpfQUf5gl0qn7twYyDMfV0eh5eGmLBm2ltLLFekpw0mRowdIX6t1fFOvTmT0a9BqaH0Qq7zg5ndv3WnN+3JsbyWWDyTt4xZZPSUU9zpuh4XxJEso",
"hangfire.Mysql": "Server=127.0.0.1;Port=3306;Database=hangfire;Uid=root;Pwd=123456;charset=utf8;SslMode=none;Allow User Variables=True",
"hangfire.redis": "127.0.0.1:6379,allowAdmin=true,SyncTimeout=10000"
},
"BackWorker": {
"UrL": "http://localhost:9006/api/values/",
"Data": {},
"ContentType": "application/json",
"Method": "GET",
"Internal": 10,
"JobName": "秒级任务"
},
"SMTPConfig": {
"SMTPServerAddress": "smtp.exmail.qq.com",
"SMTPPort": 25,
"SMTPPwd": "nhWtZHgbgvVyS7TKaz4p+w==",
"SendMailAddress": "[email protected]",
"SMTPSubject": "Hangfire任务执行失败通知",
"SendToMailList": [
{
"Email": "[email protected]"
}
]
},
/*健康检查配置项(已优化,只保留自己项目的健康检查)*/
"HealthChecks-UI": {
"HealthChecks": [
{
"Name": "Hangfire Api 健康检查",
"Uri": "http://localhost:9006/healthz"
}
],
"CheckUrls": [], // ← 已清空,避免刷屏
"Webhooks": [],
"EvaluationTimeOnSeconds": 10,
"MinimumSecondsBetweenFailureNotifications": 60
},
/*JWT令牌配置*/
"TokenSetting": {
"TokenKey": "GoDstclechengrozjsrbojPOXOYg5MbeJ1XT0uFiwDVvVBrk",
"Issuer": "issuer",
"Audience": "audience"
},
"WebApiHost": "http://localhost:5000/" //WebAPI网站地址,获取JWT令牌使用
}
//{
// "hangfire.server.serviceAddress": "http://localhost:9006/",
// "hangfire.server.website": "https://hr.sunstronggroup.com",
// "hangfire.login.user": "admin",
// "hangfire.login.pwd": "lQTk1LPfobhPJD8xx1bOag==",
// "hangfire.UseRedis": false,
// "hangfire.UseMySql": false,
// "hangfire.UseSqlServer": true,
// /*是否使用邮件通知*/
// "hangfire.UseEmail": false,
// /*是否使用apollo配置*/
// "hangfire.UseApollo": false,
// /*后台进程,支持长时间运行的任务*/
// "UseBackWorker": false,
// /* Apollo服务器配置*/
// "apolloserver": {
// "AppId": "jobserver-Jp-XA-1",
// "MetaServer": "http://localhost:8080"
// },
// "ConnectionStrings": {
// //本地测试数据库
// //"hangfire.sqlserver": "Yz4Hb1mO4rC5p6kx8XuobRAqbjPI2cJDNOjZ9Z/rJYW7FxiE60EzI1VBbaJj2s00h8E1Xnb5CLRqtbvTGJlEH6N9ypEKOh/pAon8CEhCB0myVUyps9ZT5Zc4mKxo1Zcgv59rTvwdd7Z3UFnKJc0eptO46ev6yb/uZOqmziqzrD38IdtZU5bTBz0fsD49MTiW",
// //正式数据库(26)
// "hangfire.sqlserver": "Yz4Hb1mO4rC5p6kx8XuobSRRiHoArqtb70aHkTSx913LpeNWYmGh/Ksk9jHwbun4URvU0PIGSt2pLNVykpfQUf5gl0qn7twYyDMfV0eh5eGmLBm2ltLLFekpw0mRowdIX6t1fFOvTmT0a9BqaH0Qq7zg5ndv3WnN+3JsbyWWDyTt4xZZPSUU9zpuh4XxJEso",
// "hangfire.Mysql": "Server=127.0.0.1;Port=3306;Database=hangfire;Uid=root;Pwd=123456;charset=utf8;SslMode=none;Allow User Variables=True",
// "hangfire.redis": "127.0.0.1:6379,allowAdmin=true,SyncTimeout=10000"
// },
// "BackWorker": {
// /*地址*/
// "UrL": "http://localhost:9006/api/values/",
// /*参数*/
// "Data": {},
// /*请求参数类型*/
// "ContentType": "application/json",
// /*方法类型*/
// "Method": "GET",
// /*执行频率*/
// "Internal": 10,
// /*任务名称*/
// "JobName": "秒级任务"
// },
// "SMTPConfig": {
// /*stmp服务地址*/
// "SMTPServerAddress": "smtp.exmail.qq.com",
// /*stmp端口*/
// "SMTPPort": 25,
// /*stmp密码*/
// "SMTPPwd": "nhWtZHgbgvVyS7TKaz4p+w==",
// /*发送者邮箱地址*/
// "SendMailAddress": "[email protected]",
// /*邮件标题*/
// "SMTPSubject": "Hangfire任务执行失败通知",
// /*接收者邮箱地址*/
// "SendToMailList": [
// {
// "Email": "[email protected]"
// }
// ]
// },
// /*健康检查配置项*/
// "HealthChecks-UI": {
// /*检查地址,可以配置当前程序和外部程序*/
// "HealthChecks": [
// {
// "Name": "Hangfire Api 健康检查",
// "Uri": "http://localhost:9006/healthz"
// }
// ],
// /*需要检查的Api地址*/
// "CheckUrls": [
// {
// "Uri": "http://localhost:5000/api/Values",
// "httpMethod": "Get"
// }
// ],
// "Webhooks": [], //钩子配置
// "EvaluationTimeOnSeconds": 10, //检测频率
// "MinimumSecondsBetweenFailureNotifications": 60 //推送间隔时间
// // "HealthCheckDatabaseConnectionString": "Data Source=\\healthchecksdb" //-> sqlite库存储检查配置及日志信息
// },
// /*JWT令牌配置*/
// "TokenSetting": {
// "TokenKey": "GoDstclechengrozjsrbojPOXOYg5MbeJ1XT0uFiwDVvVBrk",
// "Issuer": "issuer",
// "Audience": "audience"
// },
// "WebApiHost": "http://localhost:5000/" //WebAPI网站地址,获取JWT令牌使用
//}
本文来自博客园,作者:舒然,转载请注明原文链接:https://chuna2.787528.xyz/Jeffrey1172417122/p/19244914

浙公网安备 33010602011771号