using EEMSCenter.Hubs; using Microsoft.AspNetCore.Builder; using Microsoft.Extensions.DependencyInjection; using System.Windows; namespace EEMSCenter; internal class Program { public static WebApplication? WebApplication { get; private set; } static void Main(string[] args) { Mutex mutex = new(true, "7E862400-8020-BE75-5266-B2C4BEB54075", out bool flag); if (!flag) return; AppDomain.CurrentDomain.UnhandledException += CurrentDomain_UnhandledException; TaskScheduler.UnobservedTaskException += TaskScheduler_UnobservedTaskException; WebApplicationBuilder builder = WebApplication.CreateBuilder(args); builder.Services.AddSignalR( options => { options.EnableDetailedErrors = true; options.MaximumReceiveMessageSize = 262144;//256k //options.ClientTimeoutInterval = TimeSpan.FromSeconds(5); //options.KeepAliveInterval = TimeSpan.FromSeconds(10); //options.MaximumParallelInvocationsPerClient = 5; }); //Host Service builder.Services.AddHostedService(); WebApplication = builder.Build(); WebApplication.MapHub("/UIHub"); WebApplication.MapHub("/ClientHub"); WebApplication.RunAsync($"http://127.0.0.1:50054").Wait(); } private static void CurrentDomain_UnhandledException(object sender, UnhandledExceptionEventArgs e) { string? s = e.ExceptionObject?.ToString(); MessageBox.Show(s is null ? "Unknow UnhandledException" : s); } private static void TaskScheduler_UnobservedTaskException(object? sender, UnobservedTaskExceptionEventArgs e) { //_expLog.Fatal(e.Exception!.ToString()!); } }