Merge branch 'dev' of http://60.209.125.238:20010/chenjingyong/ds8-solution-pro into dev
commit
8458477552
@ -0,0 +1,6 @@
|
||||
@DS.WMS.TaskApi_HostAddress = http://localhost:3006
|
||||
|
||||
GET {{DS.WMS.TaskApi_HostAddress}}/weatherforecast/
|
||||
Accept: application/json
|
||||
|
||||
###
|
@ -0,0 +1,92 @@
|
||||
using Autofac;
|
||||
using Autofac.Extensions.DependencyInjection;
|
||||
using DS.Module.AutofacModule;
|
||||
using DS.Module.Core;
|
||||
using DS.Module.Core.Extensions;
|
||||
using DS.Module.Core.ServiceExtensions;
|
||||
using DS.Module.ExcelModule;
|
||||
using DS.Module.Jwt;
|
||||
using DS.Module.MultiLanguage;
|
||||
using DS.Module.SqlSugar;
|
||||
using DS.Module.DjyServiceStatus;
|
||||
using DS.Module.Swagger;
|
||||
using DS.Module.UserModule;
|
||||
using NLog.Web;
|
||||
using Swashbuckle.AspNetCore.SwaggerUI;
|
||||
using DS.Module.PrintModule;
|
||||
using DS.Module.DjyRulesEngine;
|
||||
|
||||
var builder = WebApplication.CreateBuilder(args);
|
||||
var environment = builder.Environment.EnvironmentName;
|
||||
Console.WriteLine("当前开发环境:" + environment);
|
||||
//注册配置
|
||||
builder.Configuration
|
||||
// .SetBasePath(builder.Environment.ContentRootPath)
|
||||
.AddJsonFile(path: "appsettings.json", optional: false, reloadOnChange: true)
|
||||
// .AddJsonFile(path: $"appsettings.{environment}.json", optional: true, reloadOnChange: true)
|
||||
.Build();
|
||||
builder.Configuration.AddEnvironmentVariables();
|
||||
builder.Logging.AddNLog("nlog.config");
|
||||
// Add services to the container.
|
||||
//Autofac注入
|
||||
builder.Host
|
||||
.UseServiceProviderFactory(new AutofacServiceProviderFactory())
|
||||
.ConfigureContainer<ContainerBuilder>(builder => { builder.RegisterModule(new AutofacModuleRegister()); });
|
||||
|
||||
builder.Services.AddAppWebInstal();
|
||||
builder.Services.AddCorsInstall();
|
||||
builder.Services.AddUserModuleInstall(); //用户服务
|
||||
builder.Services.AddSqlSugarInstall();
|
||||
builder.Services.AddSwaggerInstall();
|
||||
builder.Services.AddJwtInstall();
|
||||
builder.Services.AddSaasDbInstall();//分库服务
|
||||
builder.Services.AddMultiLanguageInstall();//多语言服务
|
||||
builder.Services.AddDjyModuleInstall();//Djy服务
|
||||
builder.Services.AddRuleEngineModuleInstall();//Djy规则引擎校验服务
|
||||
// builder.Services.AddEndpointsApiExplorer();
|
||||
// builder.Services.AddSwaggerGen();
|
||||
|
||||
//builder.Services.AddCrawlerModuleInstall();//运踪服务
|
||||
|
||||
var app = builder.Build();
|
||||
|
||||
// Configure the HTTP request pipeline.
|
||||
// if (app.Environment.IsDevelopment())
|
||||
// {
|
||||
// app.UseSwagger();
|
||||
// app.UseSwaggerUI();
|
||||
// }
|
||||
//swagger
|
||||
// app.UseSwagger();
|
||||
var documentName = AppSetting.app(new string[] { "SwaggerDoc", "ContactName" });
|
||||
app
|
||||
.UseSwagger(c => { c.RouteTemplate = "{documentName}/swagger.json"; })
|
||||
.UseSwaggerUI(c =>
|
||||
{
|
||||
c.SwaggerEndpoint("/" + documentName + "/swagger.json",
|
||||
AppSetting.app(new string[] { "SwaggerDoc", "ContactName" }));
|
||||
c.DocExpansion(DocExpansion.None);//DocExpansion设置为None可折叠所有方法
|
||||
c.DefaultModelExpandDepth(-1);//-1 可不显示Models
|
||||
});
|
||||
//跨域
|
||||
var policyName = AppSetting.app(new string[] { "Cors", "PolicyName" });
|
||||
if (!policyName.IsNullOrEmpty())
|
||||
{
|
||||
app.UseCors(policyName); //添加跨域中间件
|
||||
}
|
||||
|
||||
app.UseRouting();
|
||||
|
||||
app.UseStaticFiles();
|
||||
//多语言中间件
|
||||
app.UseMiddleware<MultiLanguageMiddleware>();
|
||||
// //操作日志中间件
|
||||
// app.UseMiddleware<OperationLogMiddleware>();
|
||||
|
||||
// 先开启认证
|
||||
app.UseAuthentication();
|
||||
// 然后是授权中间件
|
||||
app.UseAuthorization();
|
||||
app.UseEndpoints(endpoints => { endpoints.MapControllers(); });
|
||||
|
||||
app.Run();
|
Loading…
Reference in New Issue