删除废弃的组件
continuous-integration/drone/push Build is passing Details

IRC_NewDev
hang 2024-10-14 11:11:16 +08:00
parent c1c03a3f05
commit c9a6f8b99b
4 changed files with 27 additions and 114 deletions

View File

@ -45,24 +45,6 @@ var builder = WebApplication.CreateBuilder(new WebApplicationOptions
EnvironmentName = enviromentName
});
#region 兼容windows 服务命令行的方式
//foreach (var arg in args)
//{
// Console.WriteLine(arg);
//}
int urlsIndex = Array.FindIndex(args, arg => arg != null && arg.StartsWith("--urls"));
if (urlsIndex > -1)
{
var url = args[urlsIndex].Substring("--urls=".Length);
Console.WriteLine(url);
builder.WebHost.UseUrls(url);
}
#endregion
#region 主机配置
@ -91,6 +73,10 @@ var _configuration = builder.Configuration;
//手动注册服务
builder.Services.ConfigureServices(_configuration);
//异常处理
//builder.Services.AddExceptionHandler<GlobalExceptionHandler>();
//builder.Services.AddProblemDetails();
//健康检查
builder.Services.AddHealthChecks();
//本地化
@ -141,12 +127,6 @@ builder.Services.AddDicomSetup();
// 实时应用
builder.Services.AddSignalR();
//异常处理
//builder.Services.AddExceptionHandler<GlobalExceptionHandler>();
//builder.Services.AddProblemDetails();
#endregion
var app = builder.Build();
@ -156,8 +136,6 @@ var env = app.Environment;
app.UseMiddleware<EncryptionRequestMiddleware>();
// Configure the HTTP request pipeline.
#region 异常处理 全局业务异常已统一处理了,非业务错误会来到这里 400 -500状态码
@ -198,38 +176,10 @@ app.UseStatusCodePages(async context =>
// Log.Logger.Error(errorInfo);
//}
// });
//});
#endregion
app.UseIRacisHostStaticFileStore(env);
//本地化
app.UseLocalization();
app.UseForwardedHeaders();
//响应压缩
app.UseResponseCompression();
//不需要 token 访问的静态文件 wwwroot css, JavaScript, and images don't require authentication.
app.UseStaticFiles();
//LogDashboard
app.UseLogDashboard("/LogDashboard");
//hangfire
app.UseHangfireConfig(env);
#region 暂时废弃
//app.UseMiddleware<MultiDiskStaticFilesMiddleware>();
@ -243,44 +193,53 @@ app.UseHangfireConfig(env);
//{
// //app.UseHsts();
//}
//app.UseIRacisHostStaticFileStore(env);
#endregion
#endregion
app.UseIRacisHostStaticFileStore(env);
//本地化
app.UseLocalization();
app.UseForwardedHeaders();
//响应压缩
app.UseResponseCompression();
//不需要 token 访问的静态文件 wwwroot css, JavaScript, and images don't require authentication.
app.UseStaticFiles();
//LogDashboard
app.UseLogDashboard("/LogDashboard");
//hangfire
app.UseHangfireConfig(env);
// Swagger
SwaggerSetup.Configure(app, env);
////serilog 记录请求的用户信息
//serilog 记录请求的用户信息
app.UseSerilogConfig(env);
app.UseRouting();
app.UseCors(t => t.AllowAnyOrigin().AllowAnyMethod().AllowAnyHeader());
//app.UseIRacisHostStaticFileStore(env);
app.UseAuthentication();
app.UseAuthorization();
app.MapControllers();
app.MapHub<UploadHub>("/UploadHub");
app.MapHealthChecks("/health");
// Serilog
SerilogExtension.AddSerilogSetup(enviromentName, app.Services);
var hangfireJobService = app.Services.GetRequiredService<IIRaCISHangfireJob>();
await hangfireJobService.InitHangfireJobTaskAsync();
#endregion
try
@ -302,9 +261,6 @@ try
Log.Logger.Warning($"当前部署平台环境OSX or FreeBSD");
}
#endregion
Log.Logger.Warning($"ContentRootPath{env.ContentRootPath}");
@ -315,10 +271,9 @@ try
//Log.Logger.Warning($"ContentRootPath——GetParent{Directory.GetParent(env.ContentRootPath).Parent.FullName}");
//Log.Logger.Warning($"ContentRootPath——xx{Path.GetDirectoryName(Path.GetDirectoryName(env.ContentRootPath))}");
#endregion
app.Run();
}
catch (Exception e)
{

View File

@ -1,24 +0,0 @@
using Microsoft.Extensions.Configuration;
using Microsoft.Extensions.DependencyInjection;
namespace IRaCIS.Core.API
{
public static class EasyCachingSetup
{
public static void AddEasyCachingSetup(this IServiceCollection services, IConfiguration configuration)
{
//services.AddEasyCaching(options =>
//{
// options.UseInMemory();
// //options.UseRedis(configuration, EasyCachingConstValue.DefaultRedisName).WithMessagePack(EasyCachingConstValue.DefaultRedisName);
//});
////services.ConfigureCastleInterceptor(options => options.CacheProviderName = EasyCachingConstValue.DefaultRedisName);
//services.ConfigureCastleInterceptor(options => options.CacheProviderName = EasyCachingConstValue.DefaultInMemoryName);
}
}
}

View File

@ -1,18 +0,0 @@
using Microsoft.AspNetCore.Authorization;
using Microsoft.Extensions.DependencyInjection;
namespace IRaCIS.Core.API
{
public static class StaticFileAuthorizationSetup
{
public static void AddStaticFileAuthorizationSetup(this IServiceCollection services)
{
services.AddAuthorization(options =>
{
options.FallbackPolicy = new AuthorizationPolicyBuilder()
.RequireAuthenticatedUser()
.Build();
});
}
}
}

View File

@ -1,4 +1,5 @@
using IRaCIS.Core.Domain;
using IRaCIS.Core.Domain.Share;
using MassTransit;
using MassTransit.Mediator;
using Medallion.Threading;
@ -10,7 +11,6 @@ using System.Globalization;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using static IRaCIS.Core.Application.Service.TestService;
namespace IRaCIS.Core.Application.MassTransit.Consumer;