12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273 |
- using EVCB_OCPP.WSServer.Service;
- using Microsoft.Extensions.DependencyInjection;
- using Microsoft.Extensions.Hosting;
- using Newtonsoft.Json;
- using EVCB_OCPP.WSServer.Helper;
- using Microsoft.AspNetCore.Builder;
- using Microsoft.AspNetCore.Hosting;
- using EVCB_OCPP.WSServer.Service.WsService;
- using EVCB_OCPP.Service;
- using Microsoft.Extensions.Logging;
- namespace EVCB_OCPP.WSServer
- {
- class Program
- {
- static void Main(string[] args)
- {
- AppContext.SetData("System.Net.Security.TlsCacheSize", 200);
- Console.WriteLine("====================================================================================================");
- Console.WriteLine("=================" +
- "===================================================================================");
- Console.WriteLine("== ==");
- Console.WriteLine("== ------------ ----------- ------------- ------------- ==");
- Console.WriteLine("== --- --- ---- ---------------- ---------------- ==");
- Console.WriteLine("== --- --- ---- ---- --- ---- --- ==");
- Console.WriteLine("== --- --- ---- ---- --- ---- --- ==");
- Console.WriteLine("== --- --- ---- ---- ------------- ---- ------------- ==");
- Console.WriteLine("== --- --- ---- ---- ----------- ---- ----------- ==");
- Console.WriteLine("== --- --- ---- ---- ---- ==");
- Console.WriteLine("== --- --- ---- ---- ---- ==");
- Console.WriteLine("== ----------- ----------- ---- ---- ==");
- Console.WriteLine("== ==");
- Console.WriteLine("====================================================================================================");
- Console.WriteLine("====================================================================================================");
- ThreadPool.GetMaxThreads(out var workerThreads, out var completionThreads);
- Console.WriteLine($"Max ThreadPool workerThreads:{workerThreads} completionThreads:{completionThreads}");
- ThreadPool.SetMinThreads((int)(10), (int)(0));
- var builder = WebApplication.CreateBuilder(args);
- builder.Host
- .AddLogServcie()
- .ConfigureServices((hostContext, services) =>
- {
-
-
- services.AddProtalServer(hostContext.Configuration);
-
-
- });
- var app = builder.Build();
- app.UseHeaderRecordService();
- app.UseOcppWsService();
- app.MapApiServce();
- app.Urls.Add("http://*:80");
- app.Run();
- }
- public static object ReadJson(JsonReader reader, Type objectType, object existingValue, JsonSerializer serializer)
- {
- DateTime? timevalue = null;
- if (reader.Value != null)
- {
- DateTime date = ((DateTime)reader.Value).ToLocalTime();
- timevalue = new DateTime(date.Year, date.Month, date.Day, date.TimeOfDay.Hours, date.TimeOfDay.Minutes, date.TimeOfDay.Seconds, 000);
- }
- return timevalue;
- }
- }
- }
|