Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

我升级 nacos-sdk 到 1.3.5 修改源代码提示 Ocelot.Provider.Nacos.NacosClient.V2.RegSvcBgTask' has been registered #20

Open
ganqiyin opened this issue Aug 4, 2023 · 2 comments

Comments

@ganqiyin
Copy link

ganqiyin commented Aug 4, 2023

Microsoft.AspNetCore.Hosting.Diagnostics[6]
Application startup exception
System.AggregateException: One or more errors occurred. (No service for type 'Ocelot.Provider.Nacos.NacosClient.V2.RegSvcBgTask' has been registered.)
---> System.InvalidOperationException: No service for type 'Ocelot.Provider.Nacos.NacosClient.V2.RegSvcBgTask' has been registered.
at Microsoft.Extensions.DependencyInjection.ServiceProviderServiceExtensions.GetRequiredService(IServiceProvider provider, Type serviceType)
at Microsoft.Extensions.DependencyInjection.ServiceProviderServiceExtensions.GetRequiredService[T](IServiceProvider provider)
at Ocelot.Provider.Nacos.NacosClient.V2.ServiceCollectionExtensions.UseNacosAspNet(IApplicationBuilder app, IHostApplicationLifetime lifetime, CancellationToken cancellationToken) in D:\SourceCode\Ocelot.Provider.Nacos\src\Ocelot.Provider.Nacos\NacosClient\V2\ServiceCollectionExtensions.cs:line 56
at Ocelot.Provider.Nacos.NacosMiddlewareConfigurationProvider.<>c.<.cctor>b__3_0(IApplicationBuilder builder) in D:\SourceCode\Ocelot.Provider.Nacos\src\Ocelot.Provider.Nacos\NacosMiddlewareConfigurationProvider.cs:line 23
at Ocelot.Middleware.OcelotMiddlewareExtensions.CreateConfiguration(IApplicationBuilder builder)
at Ocelot.Middleware.OcelotMiddlewareExtensions.UseOcelot(IApplicationBuilder builder, OcelotPipelineConfiguration pipelineConfiguration)
at Ocelot.Middleware.OcelotMiddlewareExtensions.UseOcelot(IApplicationBuilder builder)
--- End of inner exception stack trace ---
at System.Threading.Tasks.Task.ThrowIfExceptional(Boolean includeTaskCanceledExceptions)
at System.Threading.Tasks.Task.Wait(Int32 millisecondsTimeout, CancellationToken cancellationToken)
at System.Threading.Tasks.Task.Wait()
at ApiGatewayDemo.Startup.Configure(IApplicationBuilder app, IWebHostEnvironment env) in D:\SourceCode\Ocelot.Provider.Nacos\demo\ApiGatewayDemo\Startup.cs:line 50
at System.RuntimeMethodHandle.InvokeMethod(Object target, Void** arguments, Signature sig, Boolean isConstructor)
at System.Reflection.MethodInvoker.Invoke(Object obj, IntPtr* args, BindingFlags invokeAttr)
at System.Reflection.RuntimeMethodInfo.Invoke(Object obj, BindingFlags invokeAttr, Binder binder, Object[] parameters, CultureInfo culture)
at Microsoft.AspNetCore.Hosting.ConfigureBuilder.Invoke(Object instance, IApplicationBuilder builder)
at Microsoft.AspNetCore.MiddlewareAnalysis.AnalysisStartupFilter.<>c__DisplayClass0_0.b__0(IApplicationBuilder builder)
at Microsoft.WebTools.BrowserLink.Net.HostingStartup.<>c__DisplayClass1_0.b__0(IApplicationBuilder app)
at Microsoft.AspNetCore.Watch.BrowserRefresh.HostingStartup.<>c__DisplayClass1_0.b__0(IApplicationBuilder app)
at Microsoft.AspNetCore.Hosting.GenericWebHostService.StartAsync(CancellationToken cancellationToken)
Dispose

@ganqiyin ganqiyin changed the title 我升级 nacos-sdk 到 1.3.5 修改源代码提示 我升级 nacos-sdk 到 1.3.5 修改源代码提示 Ocelot.Provider.Nacos.NacosClient.V2.RegSvcBgTask' has been registered Aug 4, 2023
@ganqiyin
Copy link
Author

ganqiyin commented Aug 4, 2023

@ganqiyin
Copy link
Author

把 AddHostService 改成 services.AddSingleton(); 是为啥?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant