using Microsoft.AspNetCore.Mvc; using Microsoft.AspNetCore.Server.Kestrel.Core; using System.Configuration; using System.Net; using System.Net.Http; using System.Net.Sockets; using System.Text; using WCS.BLL.Config; using WCS.BLL.Manager; using WCS.BLL.Services.IService; using WCS.BLL.Services.Service; using WCS.WebApi; using WCS.WebApi.Controllers; namespace WebApi { public class Program { public static void Main(string[] args) { WebSoceketManager.InitWebSocket(); DbInit.InitDb(); LocalFile.SaveConfig(); TCPClientManager.InitTcpClient(); ShelfManager.InitShelves(); //启动复位报警灯和板子 TCPClientManager.InitStatus(); WarningManager.StartWarningMessageThread(); var builder = WebApplication.CreateBuilder(args); // Add services to the container. builder.Services.AddControllers(); // Learn more about configuring Swagger/OpenAPI at https://aka.ms/aspnetcore/swashbuckle builder.Services.AddEndpointsApiExplorer(); builder.Services.AddSwaggerGen(); builder.Services.AddScoped(); builder.Services.AddScoped(); builder.Services.AddScoped(); builder.Services.AddScoped(); builder.Services.AddScoped(); builder.Services.AddScoped(); builder.Services.AddScoped(); builder.Services.AddScoped(); builder.Services.AddScoped(); builder.Services.AddScoped(); builder.Services.AddScoped(); //生成物料码、生成单据码采用单例模式 builder.Services.AddSingleton(); var app = builder.Build(); app.UseMiddleware(); // Configure the HTTP request pipeline. if (app.Environment.IsDevelopment()) { app.UseSwagger(); app.UseSwaggerUI(); } app.UseAuthorization(); app.MapControllers(); app.Run("http://+:8888"); } } }