123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899 |
- using EVCB_OCPP.Domain;
- using EVCB_OCPP.WSServer.Message;
- using EVCB_OCPP.WSServer.Service;
- using Microsoft.EntityFrameworkCore;
- using Microsoft.Extensions.Configuration;
- using Microsoft.Extensions.DependencyInjection;
- using Microsoft.Extensions.Hosting;
- using Microsoft.Extensions.Logging;
- using Newtonsoft.Json;
- using System;
- using NLog;
- using NLog.Web;
- using NLog.Extensions.Logging;
- using System.IO;
- using System.Data.Common;
- using Microsoft.Data.SqlClient;
- using EVCB_OCPP.WSServer.Helper;
- using Quartz;
- using EVCB_OCPP.WSServer.Jobs;
- using Microsoft.AspNetCore.Builder;
- using EVCB_OCPP.WSServer.Service.WsService;
- using EVCB_OCPP.Service;
- 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);
- //IHost host = Host.CreateDefaultBuilder(args)
- //.UseEnvironment("Development")
- //.ConfigureLogging((context, builder) => {
- // builder.ClearProviders();
- // builder.AddAzureWebAppDiagnostics();
- // NLog.LogManager.Configuration = new NLogLoggingConfiguration(context.Configuration.GetSection("NLog"));
- //})
- //.UseNLog()
- builder.Host
- .AddLogServcie()
- .ConfigureServices((hostContext, services) =>
- {
- //services.AddSingleton<MeterValueGroupSingleHandler>();
- //services.AddSingleton<IHostLifetime, DummyHostLifeTime>();
- services.AddProtalServer(hostContext.Configuration);
- //services.AddTransient<BlockingTreePrintService>();
- //services.AddTransient<GoogleGetTimePrintService>();
- });
- //.Build();
- var app = builder.Build();
- app.UseHeaderRecordService();
- app.UseOcppWsService();
- app.MapApiServce();
- app.Urls.Add("http://*:80");
- app.InitStationConfigService();
- //app.InitVendorIdReplaceService();
- app.Run();
- //host.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;
- }
- }
- }
|