!提交代码
This commit is contained in:
81
WCS.WebApi/Program.cs
Normal file
81
WCS.WebApi/Program.cs
Normal file
@ -0,0 +1,81 @@
|
||||
|
||||
using Microsoft.AspNetCore.Mvc;
|
||||
using Microsoft.AspNetCore.Server.Kestrel.Core;
|
||||
using System.Net;
|
||||
using System.Net.Http;
|
||||
using System.Net.Sockets;
|
||||
using System.Text;
|
||||
using TouchSocket.Core;
|
||||
using TouchSocket.Sockets;
|
||||
using WCS.BLL.Manager;
|
||||
using WCS.BLL.Services.IService;
|
||||
using WCS.BLL.Services.Service;
|
||||
using WCS.DAL;
|
||||
using WCS.DAL.Db;
|
||||
using WCS.WebApi;
|
||||
using WCS.WebApi.Controllers;
|
||||
using TcpClient = TouchSocket.Sockets.TcpClient;
|
||||
|
||||
namespace WebApi
|
||||
{
|
||||
public class Program
|
||||
{
|
||||
public static void Main(string[] args)
|
||||
{
|
||||
|
||||
|
||||
//LocalStatic.wCSTcpCleint = new WCS.BLL.TCPClient("127.0.0.1:20002");
|
||||
//LocalStatic.wCSTcpCleint.Send(new byte[] { 0x08, 0x00, 0x00, 0x11, 0x12, 0x13, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 });
|
||||
|
||||
DbHelp.InitDb();
|
||||
AuthDbHelp.InitDb();
|
||||
|
||||
ShelfManager.InitShelves();
|
||||
|
||||
|
||||
var builder = WebApplication.CreateBuilder(args);
|
||||
//// <20><><EFBFBD><EFBFBD>Kestrel
|
||||
//builder.WebHost.ConfigureKestrel((context, options) =>
|
||||
//{
|
||||
// // <20><><EFBFBD>ü<EFBFBD><C3BC><EFBFBD><EFBFBD>˿<EFBFBD>
|
||||
// options.Listen(IPAddress.Any, 8888); // <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>IP<49><50>ַ<EFBFBD><D6B7>5001<30>˿<EFBFBD>
|
||||
|
||||
// // <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
||||
// options.Limits.MaxRequestBodySize = 10 * 1024 * 1024; // <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>СΪ10MB
|
||||
// options.Limits.MaxConcurrentConnections = 1000; // <20><><EFBFBD><EFBFBD><F3B2A2B7><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
||||
// options.Limits.MinRequestBodyDataRate = new MinDataRate(bytesPerSecond: 100, gracePeriod: TimeSpan.FromSeconds(10)); // <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>С<EFBFBD><D0A1><EFBFBD>ݴ<EFBFBD><DDB4><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
||||
|
||||
// // <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ҫ<EFBFBD><D2AA><EFBFBD><EFBFBD>SSL/TLS<4C><53><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ӵ<EFBFBD><D3B4><EFBFBD>
|
||||
// // <20><><EFBFBD><EFBFBD>: options.Listen(IPAddress.Any, 5000, listenOptions => { listenOptions.UseHttps("path_to_certificate.pfx", "certificate_password"); });
|
||||
//});
|
||||
// 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<IInstoreService, InstoreService>();
|
||||
builder.Services.AddScoped<IOutstoreService, OutstoreService>();
|
||||
builder.Services.AddScoped<IHomerService, HomerService>();
|
||||
builder.Services.AddScoped<IUserService, UserService>();
|
||||
builder.Services.AddScoped<IInterfaceRecordService, InterfaceRecordService>();
|
||||
builder.Services.AddScoped<IMatBaseInfoService, MatBaseInfoService>();
|
||||
builder.Services.AddScoped<IMatInventoryDetailService, MatInventoryDetailService>();
|
||||
builder.Services.AddScoped<IStoreInfoService, StoreInfoService>();
|
||||
|
||||
var app = builder.Build();
|
||||
|
||||
app.UseMiddleware<RequestResponseLoggingMiddleware>();
|
||||
// Configure the HTTP request pipeline.
|
||||
if (app.Environment.IsDevelopment())
|
||||
{
|
||||
app.UseSwagger();
|
||||
app.UseSwaggerUI();
|
||||
}
|
||||
|
||||
app.UseAuthorization();
|
||||
app.MapControllers();
|
||||
app.Run("http://+:8888");
|
||||
}
|
||||
}
|
||||
}
|
Reference in New Issue
Block a user