mirror of
https://gitee.com/ccnetcore/Yi
synced 2026-03-03 08:10:51 +08:00
完成错误中间件,统一返回结果
This commit is contained in:
@@ -1,3 +1,4 @@
|
||||
using AspNetCore.Microsoft.AspNetCore.Hosting;
|
||||
using Yi.Framework.Core.Autofac.Extensions;
|
||||
using Yi.Framework.Core.Autofac.Modules;
|
||||
using Yi.Framework.Core.Extensions;
|
||||
@@ -6,7 +7,8 @@ using Yi.Framework.Web;
|
||||
TimeTest.Start();
|
||||
var builder = WebApplication.CreateBuilder(args);
|
||||
|
||||
builder.WebHost.UseUrls(builder.Configuration.GetValue<string>("StartUrl"));
|
||||
//设置启动url
|
||||
builder.WebHost.UseStartUrlsServer(builder.Configuration, "StartUrl");
|
||||
|
||||
//添加模块
|
||||
builder.UseYiModules(typeof(YiFrameworkWebModule));
|
||||
@@ -17,10 +19,12 @@ builder.Host.ConfigureAutoFacContainer(container =>
|
||||
container.RegisterYiModule(AutoFacModuleEnum.PropertiesAutowiredModule, typeof(YiFrameworkWebModule).Assembly);
|
||||
});
|
||||
|
||||
|
||||
var app = builder.Build();
|
||||
|
||||
|
||||
var t = app.Services.GetService<Test2Entity>();
|
||||
|
||||
//全局错误中间件,需要放在最早
|
||||
app.UseErrorHandlingServer();
|
||||
app.MapControllers();
|
||||
|
||||
app.Run();
|
||||
|
||||
Reference in New Issue
Block a user