From cdd170dd9008d8124d63c76ba186e34cfe61a619 Mon Sep 17 00:00:00 2001 From: yanjinhui <3306209981@qq.com> Date: 星期二, 11 三月 2025 08:40:56 +0800 Subject: [PATCH] 美新 --- 项目代码/WIDESEAWCS_Server 正式/WIDESEAWCS_Server/Program.cs | 19 +++++++++---------- 1 files changed, 9 insertions(+), 10 deletions(-) diff --git "a/\351\241\271\347\233\256\344\273\243\347\240\201/WIDESEAWCS_Server \346\255\243\345\274\217/WIDESEAWCS_Server/Program.cs" "b/\351\241\271\347\233\256\344\273\243\347\240\201/WIDESEAWCS_Server \346\255\243\345\274\217/WIDESEAWCS_Server/Program.cs" index 694b64e..7cd10e3 100644 --- "a/\351\241\271\347\233\256\344\273\243\347\240\201/WIDESEAWCS_Server \346\255\243\345\274\217/WIDESEAWCS_Server/Program.cs" +++ "b/\351\241\271\347\233\256\344\273\243\347\240\201/WIDESEAWCS_Server \346\255\243\345\274\217/WIDESEAWCS_Server/Program.cs" @@ -21,9 +21,8 @@ using Autofac.Core; using WIDESEAWCS_QuartzJob.QuartzExtensions; using Microsoft.AspNetCore.Builder; -using WIDESEA_SerialPortService; +//using WIDESEA_SerialPortService; using WIDESEA_ISerialPortService; -using WIDESEA_SerialPortTestService; var builder = WebApplication.CreateBuilder(args); @@ -82,15 +81,15 @@ //builder.Services.AddSingleton<SerialPortTestService>(sp => // new SerialPortTestService("COM3")); // 这里可以传入串口号 -// 注册 ISerialPortService 实现 -builder.Services.AddSingleton<ISerialPortService, SerialPortService>(); +//// 注册 ISerialPortService 实现 +//builder.Services.AddSingleton<ISerialPortService, SerialPortService>(); // 注册 SerialPortTestService,并注入 ISerialPortService -builder.Services.AddSingleton<SerialPortTestService>(sp => -{ - var serialPortService = sp.GetRequiredService<ISerialPortService>(); - return new SerialPortTestService("COM3", serialPortService); -}); +//builder.Services.AddSingleton<SerialPortTestJob>(sp => +//{ +// var serialPortService = sp.GetRequiredService<ISerialPortService>(); +// return new SerialPortTestJob("COM3", serialPortService); +//}); //// 注入 SerialPortService //builder.Services.AddScoped<ISerialPortService, SerialPortService>(); @@ -130,7 +129,7 @@ //if (app.Environment.IsDevelopment()) { //todo - //app.UseSwaggerAuthorized(); + app.UseSwaggerAuthorized(); app.UseSwaggerMiddle(() => Assembly.GetExecutingAssembly().GetManifestResourceStream("WIDESEAWCS_Server.index.html")); }//判断是否需要打开swagger -- Gitblit v1.9.3