38 lines
1.1 KiB
C#
38 lines
1.1 KiB
C#
|
|
|
|||
|
|
using System.Text;
|
|||
|
|
using Autofac.Extensions.DependencyInjection;
|
|||
|
|
using Autofac;
|
|||
|
|
using WmsMobileServe.AppRunning;
|
|||
|
|
using WmsMobileServe.Utils;
|
|||
|
|
|
|||
|
|
Console.Title = "WMS<4D><53>̨<EFBFBD><CCA8><EFBFBD><EFBFBD>";
|
|||
|
|
Console.OutputEncoding = Encoding.UTF8;
|
|||
|
|
ConsoleLog.DisbleQuickEditMode();
|
|||
|
|
|
|||
|
|
var builder = WebApplication.CreateBuilder(args);
|
|||
|
|
builder.Services.AddControllers().AddJsonOptions(options =>
|
|||
|
|
{
|
|||
|
|
options.JsonSerializerOptions.PropertyNamingPolicy = null; // <20>ķ<DEB8><C4B7><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ã<EFBFBD><C3A3><EFBFBD><EFBFBD><EFBFBD>ԭʵ<D4AD><CAB5><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
|||
|
|
});
|
|||
|
|
builder.Services.AddHostedService<HostService>();
|
|||
|
|
// <20><><EFBFBD>ӿ<EFBFBD><D3BF><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>κ<EFBFBD><CEBA>˷<EFBFBD><CBB7><EFBFBD>
|
|||
|
|
builder.Services.AddCors(options =>
|
|||
|
|
{
|
|||
|
|
options.AddPolicy("any", policyBuilder =>
|
|||
|
|
{
|
|||
|
|
policyBuilder.WithOrigins("*").AllowAnyOrigin().AllowAnyMethod().AllowAnyHeader();
|
|||
|
|
});
|
|||
|
|
});
|
|||
|
|
builder.WebHost.UseUrls("http://*:19990");
|
|||
|
|
builder.Host.UseServiceProviderFactory(new AutofacServiceProviderFactory()); // ʹ<><CAB9> autoFac <20>滻ע<E6BBBB><D7A2><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
|||
|
|
builder.Host.ConfigureContainer<ContainerBuilder>(builder =>
|
|||
|
|
{
|
|||
|
|
builder.RegisterModule<AutofacModule>();
|
|||
|
|
});
|
|||
|
|
|
|||
|
|
var app = builder.Build();
|
|||
|
|
app.UseCors("any");
|
|||
|
|
app.UseAuthorization();
|
|||
|
|
app.MapControllers();
|
|||
|
|
app.Run();
|