✨ init
commit
f09a4a579e
@ -0,0 +1,13 @@
|
|||||||
|
# 默认忽略的文件
|
||||||
|
/shelf/
|
||||||
|
/workspace.xml
|
||||||
|
# Rider 忽略的文件
|
||||||
|
/.idea.Hangfire.Job.iml
|
||||||
|
/modules.xml
|
||||||
|
/projectSettingsUpdater.xml
|
||||||
|
/contentModel.xml
|
||||||
|
# 基于编辑器的 HTTP 客户端请求
|
||||||
|
/httpRequests/
|
||||||
|
# Datasource local storage ignored files
|
||||||
|
/dataSources/
|
||||||
|
/dataSources.local.xml
|
@ -0,0 +1,10 @@
|
|||||||
|
using Microsoft.AspNetCore.Mvc;
|
||||||
|
|
||||||
|
namespace Hangfire.Job.Controllers;
|
||||||
|
|
||||||
|
[ApiController]
|
||||||
|
[Route("[controller]")]
|
||||||
|
public class HangfireController : ControllerBase
|
||||||
|
{
|
||||||
|
|
||||||
|
}
|
@ -0,0 +1,19 @@
|
|||||||
|
<Project Sdk="Microsoft.NET.Sdk.Web">
|
||||||
|
|
||||||
|
<PropertyGroup>
|
||||||
|
<TargetFramework>net6.0</TargetFramework>
|
||||||
|
<Nullable>enable</Nullable>
|
||||||
|
<ImplicitUsings>enable</ImplicitUsings>
|
||||||
|
</PropertyGroup>
|
||||||
|
|
||||||
|
<ItemGroup>
|
||||||
|
<PackageReference Include="FaceIT.Hangfire.Tags.SqlServer" Version="1.9.2" />
|
||||||
|
<PackageReference Include="Hangfire.AspNetCore" Version="1.8.3" />
|
||||||
|
<PackageReference Include="Hangfire.Core" Version="1.8.3" />
|
||||||
|
<PackageReference Include="Hangfire.HttpJob" Version="3.8.1" />
|
||||||
|
<PackageReference Include="Hangfire.SqlServer" Version="1.8.3" />
|
||||||
|
<PackageReference Include="Microsoft.Data.SqlClient" Version="5.2.2" />
|
||||||
|
<PackageReference Include="Swashbuckle.AspNetCore" Version="6.5.0"/>
|
||||||
|
</ItemGroup>
|
||||||
|
|
||||||
|
</Project>
|
@ -0,0 +1,30 @@
|
|||||||
|
using Hangfire;
|
||||||
|
using Hangfire.Console;
|
||||||
|
using Hangfire.HttpJob;
|
||||||
|
using Hangfire.Tags.SqlServer;
|
||||||
|
|
||||||
|
var builder = WebApplication.CreateBuilder(args);
|
||||||
|
|
||||||
|
|
||||||
|
var connectionString = builder.Configuration["ConnectionStrings:Default"];
|
||||||
|
|
||||||
|
builder.Services.AddHangfire(config => config
|
||||||
|
.UseSqlServerStorage(connectionString)
|
||||||
|
// .UseConsole(new ConsoleOptions()
|
||||||
|
// {
|
||||||
|
// BackgroundColor = "#000079"
|
||||||
|
// })
|
||||||
|
// .UseTagsWithSql()
|
||||||
|
.UseHangfireHttpJob()
|
||||||
|
);
|
||||||
|
|
||||||
|
builder.Services.AddHangfireServer();
|
||||||
|
|
||||||
|
|
||||||
|
var app = builder.Build();
|
||||||
|
|
||||||
|
app.UseHangfireDashboard();
|
||||||
|
// app.UseHangfireServer();
|
||||||
|
|
||||||
|
app.MapGet("/", () => "Hangfire service is running!");
|
||||||
|
app.Run();
|
@ -0,0 +1,8 @@
|
|||||||
|
{
|
||||||
|
"Logging": {
|
||||||
|
"LogLevel": {
|
||||||
|
"Default": "Information",
|
||||||
|
"Microsoft.AspNetCore": "Warning"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
@ -0,0 +1,20 @@
|
|||||||
|
{
|
||||||
|
"Logging": {
|
||||||
|
"LogLevel": {
|
||||||
|
"Default": "Information",
|
||||||
|
"Microsoft.AspNetCore": "Warning",
|
||||||
|
"Hangfire": "Information"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"AllowedHosts": "*",
|
||||||
|
"ConnectionStrings": {
|
||||||
|
"Default": "server=192.168.1.248;database=HangfireDB;uid=sa;pwd=123;TrustServerCertificate=True;"
|
||||||
|
},
|
||||||
|
"Kestrel": {
|
||||||
|
"Endpoints": {
|
||||||
|
"Http": {
|
||||||
|
"Url": "http://0.0.0.0:8093"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
Loading…
Reference in New Issue