Add Hangfire

dhcp-server
Pat Hartl 2023-04-19 18:09:34 -05:00
parent d2161e606d
commit e64c4b2be1
2 changed files with 14 additions and 2 deletions

View File

@ -16,6 +16,9 @@
<PackageReference Include="Blazor-ApexCharts" Version="0.9.18-beta" />
<PackageReference Include="BlazorMonaco" Version="3.0.0" />
<PackageReference Include="ByteSize" Version="2.1.1" />
<PackageReference Include="Hangfire.AspNetCore" Version="1.7.34" />
<PackageReference Include="Hangfire.Core" Version="1.7.34" />
<PackageReference Include="Hangfire.InMemory" Version="0.3.7" />
<PackageReference Include="IGDB" Version="2.3.1" />
<PackageReference Include="Microsoft.AspNetCore.Authentication.JwtBearer" Version="7.0.4" />
<PackageReference Include="Microsoft.AspNetCore.Diagnostics.EntityFrameworkCore" Version="7.0.4" />

View File

@ -3,13 +3,12 @@ using LANCommander.Data;
using LANCommander.Data.Models;
using LANCommander.Hubs;
using LANCommander.Services;
using Microsoft.AspNetCore.Authentication.JwtBearer;
using Microsoft.AspNetCore.Identity;
using Microsoft.EntityFrameworkCore;
using Microsoft.Extensions.DependencyInjection;
using Microsoft.IdentityModel.Tokens;
using NLog.Web;
using System.Text;
using Hangfire;
var builder = WebApplication.CreateBuilder(args);
@ -84,6 +83,14 @@ builder.Services.AddControllers().AddJsonOptions(x =>
x.JsonSerializerOptions.ReferenceHandler = System.Text.Json.Serialization.ReferenceHandler.IgnoreCycles;
});
builder.Services.AddHangfire(configuration =>
configuration
.SetDataCompatibilityLevel(CompatibilityLevel.Version_170)
.UseSimpleAssemblyNameTypeSerializer()
.UseRecommendedSerializerSettings()
.UseInMemoryStorage());
builder.Services.AddHangfireServer();
builder.Services.AddEndpointsApiExplorer();
builder.Services.AddSwaggerGen();
@ -134,6 +141,8 @@ else
app.UseHsts();
}
app.UseHangfireDashboard();
// app.UseHttpsRedirection();
app.UseStaticFiles();