|
|
|
|
using Ds.WMS.WebCore;
|
|
|
|
|
using Microsoft.OpenApi.Models;
|
|
|
|
|
using System.Reflection;
|
|
|
|
|
|
|
|
|
|
var builder = WebApplication.CreateBuilder(args).UseMyConfiguration();
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// ʹ<>ö<EFBFBD>̬<EFBFBD><CCAC><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD>뼯<EFBFBD><EBBCAF> webcore <20><><EFBFBD><EFBFBD>ʵ<EFBFBD><CAB5><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ļ<EFBFBD><C4BC>Ľ<EFBFBD><C4BD><EFBFBD>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// Add services to the container.
|
|
|
|
|
// Learn more about configuring Swagger/OpenAPI at https://aka.ms/aspnetcore/swashbuckle
|
|
|
|
|
builder.Services.AddEndpointsApiExplorer();
|
|
|
|
|
|
|
|
|
|
builder.Services.AddControllers(options =>
|
|
|
|
|
{
|
|
|
|
|
options.Filters.Add(new DsAppActionFilter());
|
|
|
|
|
});
|
|
|
|
|
// ʹ<><CAB9><EFBFBD><EFBFBD>չ<EFBFBD><D5B9><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> Startup <20><>
|
|
|
|
|
|
|
|
|
|
builder.Services.AddSwaggerGen(c =>
|
|
|
|
|
{
|
|
|
|
|
c.SwaggerDoc("v1", new OpenApiInfo { Title = "My API", Version = "v1" });
|
|
|
|
|
var xmlFile = $"{Assembly.GetExecutingAssembly().GetName().Name}.xml";
|
|
|
|
|
var xmlPath = Path.Combine(AppContext.BaseDirectory, xmlFile);
|
|
|
|
|
c.IncludeXmlComments(xmlPath);
|
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
builder.UseDynamicStartups();
|
|
|
|
|
|
|
|
|
|
var app = builder.Build();
|
|
|
|
|
|
|
|
|
|
app.UseMiddleware<RequestLoggingMiddleware>();
|
|
|
|
|
|
|
|
|
|
// Configure the HTTP request pipeline.
|
|
|
|
|
//if (app.Environment.IsDevelopment())
|
|
|
|
|
//{
|
|
|
|
|
// app.UseSwagger();
|
|
|
|
|
// app.UseSwaggerUI();
|
|
|
|
|
//}
|
|
|
|
|
// <20><><EFBFBD><EFBFBD><EFBFBD>м<EFBFBD><D0BC><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> Swagger <20><>Ϊ JSON <20>ս<EFBFBD><D5BD><EFBFBD>
|
|
|
|
|
app.UseSwagger();
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// <20><><EFBFBD><EFBFBD><EFBFBD>м<EFBFBD><D0BC><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> swagger-ui<75><69>ָ<EFBFBD><D6B8> Swagger JSON <20>ս<EFBFBD><D5BD><EFBFBD>
|
|
|
|
|
app.UseSwaggerUI(c =>
|
|
|
|
|
{
|
|
|
|
|
c.SwaggerEndpoint("/swagger/v1/swagger.json", "My API V1");
|
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
app.UseHttpsRedirection();
|
|
|
|
|
|
|
|
|
|
app.UseRouting();
|
|
|
|
|
app.UseEndpoints(endpoints =>
|
|
|
|
|
{
|
|
|
|
|
endpoints.MapControllers();
|
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
// ˳<><CBB3><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
|
|
|
|
app.UseDynamicStartups();
|
|
|
|
|
app.Run();
|
|
|
|
|
|