Open yyang1207 opened 2 years ago
监听已经开启,就是没变更通知。。。。。
启动日志如下
info: Nacos.V2.Config.NacosConfigService[0] [config-0-5237615d-8b7b-4328-b797-c0617ddfa0ed] Connected,notify listen context... info: Nacos.V2.Naming.NacosNamingService[0] start up udp server....., port: 55356 info: Ocelot.Provider.Nacos.NacosClient.V2.RegSvcBgTask[0] register instance to nacos server, 【Instance{instanceId='', ip='10.1.6.50', port=9100, weight=100, healthy=True, enabled=True, ephemeral=True, clusterName='DEFAULT', serviceName='Gateway.Ocelot', metadata={"preserved.register.source":"ASPNET_CORE","DOTNET_VERSION":"3.1.22","HOST_OS":"Microsoft Windows NT 6.2.9200.0"}}】 info: Nacos.V2.Naming.NacosNamingService[0] [REGISTER-SERVICE] public registering service Gateway.Ocelot with instance: Instance{instanceId='', ip='10.1.6.50', port=9100, weight=100, healthy=True, enabled=True, ephemeral=True, clusterName='DEFAULT', serviceName='Gateway.Ocelot', metadata={"preserved.register.source":"ASPNET_CORE","DOTNET_VERSION":"3.1.22","HOST_OS":"Microsoft Windows NT 6.2.9200.0"}} info: Nacos.V2.Naming.NacosNamingService[0] [BEAT] adding beat: BeatInfo{port=9100, ip='10.1.6.50', weight=100, serviceName='DEFAULT_GROUP@@Gateway.Ocelot', cluster='DEFAULT', metadata={"preserved.register.source":"ASPNET_CORE","DOTNET_VERSION":"3.1.22","HOST_OS":"Microsoft Windows NT 6.2.9200.0"}, scheduled=False, period=5000, stopped=False} to beat map. 。。。。。。。。。。注册监听。。。。。。。。 info: Nacos.V2.Config.NacosConfigService[0] [config_rpc_client] [subscribe] demo+DEFAULT_GROUP+public info: Microsoft.Hosting.Lifetime[0] Now listening on: http://10.1.6.50:9100 info: Microsoft.Hosting.Lifetime[0] Application started. Press Ctrl+C to shut down. info: Microsoft.Hosting.Lifetime[0] Hosting environment: Development info: Microsoft.Hosting.Lifetime[0] Content root path: D:\Projects\demo\Ocelot.Provider.Nacos\src\Gateway.Ocelot info: Nacos.V2.Config.NacosConfigService[0] [config-0-7a99332f-5df8-4520-97d6-124213777d22] Connected,notify listen context...
当时没考虑到绑定 .NetCore的 IConfiguration,自己写的监听方法。 请在Startup的 Configure(IApplicationBuilder app, IWebHostEnvironment env)中添加
app.UseOcelot(configuration).Wait(); app.UseOcelotNacosConfigureListeners();
监听已经开启,就是没变更通知。。。。。
启动日志如下
info: Nacos.V2.Config.NacosConfigService[0] [config-0-5237615d-8b7b-4328-b797-c0617ddfa0ed] Connected,notify listen context... info: Nacos.V2.Naming.NacosNamingService[0] start up udp server....., port: 55356 info: Ocelot.Provider.Nacos.NacosClient.V2.RegSvcBgTask[0] register instance to nacos server, 【Instance{instanceId='', ip='10.1.6.50', port=9100, weight=100, healthy=True, enabled=True, ephemeral=True, clusterName='DEFAULT', serviceName='Gateway.Ocelot', metadata={"preserved.register.source":"ASPNET_CORE","DOTNET_VERSION":"3.1.22","HOST_OS":"Microsoft Windows NT 6.2.9200.0"}}】 info: Nacos.V2.Naming.NacosNamingService[0] [REGISTER-SERVICE] public registering service Gateway.Ocelot with instance: Instance{instanceId='', ip='10.1.6.50', port=9100, weight=100, healthy=True, enabled=True, ephemeral=True, clusterName='DEFAULT', serviceName='Gateway.Ocelot', metadata={"preserved.register.source":"ASPNET_CORE","DOTNET_VERSION":"3.1.22","HOST_OS":"Microsoft Windows NT 6.2.9200.0"}} info: Nacos.V2.Naming.NacosNamingService[0] [BEAT] adding beat: BeatInfo{port=9100, ip='10.1.6.50', weight=100, serviceName='DEFAULT_GROUP@@Gateway.Ocelot', cluster='DEFAULT', metadata={"preserved.register.source":"ASPNET_CORE","DOTNET_VERSION":"3.1.22","HOST_OS":"Microsoft Windows NT 6.2.9200.0"}, scheduled=False, period=5000, stopped=False} to beat map. 。。。。。。。。。。注册监听。。。。。。。。 info: Nacos.V2.Config.NacosConfigService[0] [config_rpc_client] [subscribe] demo+DEFAULT_GROUP+public info: Microsoft.Hosting.Lifetime[0] Now listening on: http://10.1.6.50:9100 info: Microsoft.Hosting.Lifetime[0] Application started. Press Ctrl+C to shut down. info: Microsoft.Hosting.Lifetime[0] Hosting environment: Development info: Microsoft.Hosting.Lifetime[0] Content root path: D:\Projects\demo\Ocelot.Provider.Nacos\src\Gateway.Ocelot info: Nacos.V2.Config.NacosConfigService[0] [config-0-7a99332f-5df8-4520-97d6-124213777d22] Connected,notify listen context...