You cannot select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

45 lines
1.2 KiB
C#

using Ds.Module.DynamicApi;
using Ds.Module.ResultFilter;
using GZY.Quartz.MUI.Extensions;
var builder = WebApplication.CreateBuilder(args);
// Add services to the container.
// 添加SignalR服务
builder.Services.AddSignalR();
builder.Services.AddControllers().AddDynamicWebApi();
// Learn more about configuring Swagger/OpenAPI at https://aka.ms/aspnetcore/swashbuckle
builder.Services.AddEndpointsApiExplorer();
builder.Services.AddSwaggerGen();
builder.Services.AddQuartzUI();
//开启ClassJob则注入以下内容
//services.AddQuartzClassJobs();
//数据库注入方式i
//var optionsBuilder = new DbContextOptionsBuilder();
//optionsBuilder.UseMysql("server=xxxxxxx;database=xxx;User Id=xxxx;PWD=xxxx", b => b.MaxBatchSize(1));//创建数据库连接
//services.AddQuartzUI(optionsBuilder.Options); //注入UI组件
var app = builder.Build();
// Configure the HTTP request pipeline.
if (app.Environment.IsDevelopment())
{
app.UseSwagger();
app.UseSwaggerUI();
}
//添加SignalR端点
//endpoints.MapHub<ServerMonitorHub>("/serverMonitorHub");
//异常错误中间件处理
app.UseMiddleware<ExceptionHandlerMiddleware>();
app.UseHttpsRedirection();
app.UseAuthorization();
app.MapControllers();
app.UseQuartz();
//浏览器运行
//https://localhost:7150/quartzui
app.Run();