From b8cf451145b72ff7ce728c101adad3574e722697 Mon Sep 17 00:00:00 2001
From: zhengyiming <540361168@qq.com>
Date: 星期二, 09 九月 2025 08:59:50 +0800
Subject: [PATCH] fix: s

---
 FlexJobApi.FlexJobServer.Test/Startup.cs |   42 +-----------------------------------------
 1 files changed, 1 insertions(+), 41 deletions(-)

diff --git a/FlexJobApi.FlexJobServer.Test/Startup.cs b/FlexJobApi.FlexJobServer.Test/Startup.cs
index 9d58144..f5da276 100644
--- a/FlexJobApi.FlexJobServer.Test/Startup.cs
+++ b/FlexJobApi.FlexJobServer.Test/Startup.cs
@@ -18,54 +18,14 @@
     {
         public void ConfigureServices(IServiceCollection services, IConfiguration config)
         {
-            services.AddSingleton<IConsulClient, ConsulClient>(p => new ConsulClient(options =>
-            {
-                var address = config["Consul:Address"] ?? "http://localhost:8500";
-                options.Address = new Uri(address);
-            }));
             services.AddComponent<DistributedCacheServiceComponent>();
             services.AddHttpRemote();
-            services.AddSingleton<ResourceHttpUtils>();
         }
 
         public void Configure(IApplicationBuilder app, IWebHostEnvironment env, IConfiguration config)
         {
-            var consulClient = app.ApplicationServices.GetRequiredService<IConsulClient>();
-            var lifetime = app.ApplicationServices.GetRequiredService<IHostApplicationLifetime>();
+            app.UseInject(string.Empty);
 
-            // 鏈嶅姟閰嶇疆锛堜粠appsettings.json璇诲彇锛�
-            var serviceName = config["Consul:ServiceName"] ?? "UnknownService";
-            var serviceHost = config["Consul:ServiceIP"] ?? "localhost";
-            var servicePort = int.Parse(config["Consul:ServicePort"]); // 鎴栫洿鎺ョ敤鍚姩绔彛
-
-            // 鏈嶅姟鍞竴ID锛堥伩鍏嶅悓涓�鏈嶅姟澶氬疄渚嬪啿绐侊級
-            var serviceId = $"{serviceName}-{serviceHost}-{servicePort}";
-
-            // 鏈嶅姟娉ㄥ唽淇℃伅
-            var registration = new AgentServiceRegistration
-            {
-                ID = serviceId,
-                Name = serviceName,
-                Address = serviceHost,
-                Port = servicePort,
-                // 鍋ュ悍妫�鏌ラ厤缃�
-                Check = new AgentServiceCheck
-                {
-                    HTTP = $"http://{serviceHost}:{servicePort}{config["Consul:ServiceHealthCheck"]}",
-                    Interval = TimeSpan.FromSeconds(10),
-                    Timeout = TimeSpan.FromSeconds(5),
-                    DeregisterCriticalServiceAfter = TimeSpan.FromSeconds(30)
-                }
-            };
-
-            // 娉ㄥ唽鏈嶅姟
-            consulClient.Agent.ServiceRegister(registration).Wait();
-
-            // 搴旂敤鍋滄鏃舵敞閿�鏈嶅姟
-            lifetime.ApplicationStopping.Register(() =>
-            {
-                consulClient.Agent.ServiceDeregister(serviceId).Wait();
-            });
         }
     }
 }

--
Gitblit v1.9.1