| | |
| | | using WIDESEAWCS_Core.Helper; |
| | | using WIDESEAWCS_Core.Extensions; |
| | | using WIDESEAWCS_Core.Middlewares; |
| | | using System.Reflection; |
| | | using WIDESEAWCS_Core.Filter; |
| | | using Newtonsoft.Json.Converters; |
| | | using Newtonsoft.Json.Serialization; |
| | | using Newtonsoft.Json; |
| | | using System.Text; |
| | | using Microsoft.AspNetCore.Mvc.Controllers; |
| | | using Microsoft.Extensions.DependencyInjection.Extensions; |
| | | using Microsoft.AspNetCore.Mvc.ModelBinding.Validation; |
| | | using WIDESEAWCS_Core; |
| | | using WIDESEAWCS_Core.BaseServices; |
| | | using Autofac.Extensions.DependencyInjection; |
| | | using Autofac; |
| | | using WIDESEAWCS_WCSServer.Filter; |
| | | using Autofac.Extensions.DependencyInjection; |
| | | using Microsoft.AspNetCore.Mvc.Controllers; |
| | | using Microsoft.AspNetCore.SignalR; |
| | | using Microsoft.Extensions.DependencyInjection.Extensions; |
| | | using Newtonsoft.Json; |
| | | using Newtonsoft.Json.Converters; |
| | | using System.Reflection; |
| | | using System.Text; |
| | | using WIDESEAWCS_Core; |
| | | using WIDESEAWCS_Core.Authorization; |
| | | using WIDESEAWCS_Core.Core; |
| | | using WIDESEAWCS_QuartzJob.Seed; |
| | | using Autofac.Core; |
| | | using WIDESEAWCS_Core.Extensions; |
| | | using WIDESEAWCS_Core.Filter; |
| | | using WIDESEAWCS_Core.Helper; |
| | | using WIDESEAWCS_Core.LogHelper; |
| | | using WIDESEAWCS_Core.Middlewares; |
| | | using WIDESEAWCS_QuartzJob.QuartzExtensions; |
| | | using Microsoft.AspNetCore.Builder; |
| | | using Microsoft.AspNetCore.SignalR; |
| | | using WIDESEAWCS_QuartzJob.Seed; |
| | | using WIDESEAWCS_SignalR; |
| | | using WIDESEAWCS_Tasks; |
| | | using WIDESEAWCS_WCSServer.Filter; |
| | | |
| | | var builder = WebApplication.CreateBuilder(args); |
| | | |
| | | int workerThreads = Environment.ProcessorCount * 8; |
| | | int completionThreads = Environment.ProcessorCount; |
| | | ThreadPool.SetMaxThreads(workerThreads, completionThreads); |
| | | |
| | | AppDomain.CurrentDomain.FirstChanceException += (sender, e) => |
| | | { |
| | | bool flag = e.Exception.TargetSite?.DeclaringType?.Namespace?.StartsWith("WIDESEA") == true; |
| | | |
| | | if (e.Exception is not OperationCanceledException && flag) |
| | | { |
| | | string folderPath = Path.Combine(AppDomain.CurrentDomain.BaseDirectory, $"Log\\Exception"); |
| | | Exception ex = e.Exception; |
| | | StringBuilder builder = new StringBuilder(); |
| | | builder.Append("错误信息:"); |
| | | builder.Append(ex.Message); |
| | | builder.Append(Environment.NewLine); |
| | | builder.Append("错误源:"); |
| | | builder.Append(ex.Source); |
| | | builder.Append(Environment.NewLine); |
| | | builder.Append("错误堆栈:"); |
| | | builder.Append(ex.StackTrace); |
| | | builder.Append(Environment.NewLine); |
| | | builder.Append("错误类型:"); |
| | | builder.Append(ex.GetType().ToString()); |
| | | builder.Append(Environment.NewLine); |
| | | builder.Append("错误方法:"); |
| | | builder.Append(ex.TargetSite?.ToString()); |
| | | builder.Append(Environment.NewLine); |
| | | builder.Append(Environment.NewLine); |
| | | |
| | | QuartzLogger.WriteLogToFile($"Error_全局错误", builder.ToString()); |
| | | } |
| | | }; |
| | | |
| | | if (!HslCommunication.Authorization.SetAuthorizationCode("95f1611d-633c-46ea-b03a-38ede1629f74")) |
| | | { |
| | | ConsoleHelper.WriteErrorLine("授权失败!当前程序只能使用24小时!"); |
| | | } |
| | | else |
| | | ConsoleHelper.WriteSuccessLine("授权成功!"); |
| | | |
| | | builder.Host.UseServiceProviderFactory(new AutofacServiceProviderFactory()).ConfigureContainer<ContainerBuilder>(builder => |
| | | { |
| | |
| | | config.AddJsonFile("appsettings.json", optional: true, reloadOnChange: false); |
| | | }); ; |
| | | builder.Inject().ConfigureApplication(); |
| | | |
| | | |
| | | // 2、配置服务 |
| | | builder.Services.AddSingleton(new AppSettings(builder.Configuration));//注册 |
| | |
| | | builder.Services.AddIpPolicyRateLimitSetup(builder.Configuration);//IPLimit限流 启动服务 |
| | | |
| | | builder.Services.AddScoped<UseServiceDIAttribute>(); |
| | | builder.Services.AddScoped<CommonConveyorLineJob>(); |
| | | |
| | | builder.Services.AddSession(); |
| | | |
| | |
| | | |
| | | builder.Services.Replace(ServiceDescriptor.Transient<IControllerActivator, ServiceBasedControllerActivator>()); |
| | | Encoding.RegisterProvider(CodePagesEncodingProvider.Instance); |
| | | |
| | | |
| | | var app = builder.Build(); |
| | | |
| | |
| | | app.MapHubs(); |
| | | app.MapControllers(); |
| | | |
| | | app.Run(); |
| | | app.Run(); |