No service for type 'Senparc.Weixin.Entities.ISenparcWeixinSettingForWxOpen' has been registered

¥50.00

启动.net 5的项目报错:No service for type 'Senparc.Weixin.Entities.ISenparcWeixinSettingForWxOpen' has been registered


Could not resolve a service of type 'Senparc.Weixin.Entities.ISenparcWeixinSettingForWxOpen' for the parameter 'senparcWeixinSetting' of method 'Configure' on type 'Ranwei.Web.Api.Startup'.

An error occurred while starting the application.
InvalidOperationException: No service for type 'Senparc.Weixin.Entities.ISenparcWeixinSettingForWxOpen' has been registered.
Microsoft.Extensions.DependencyInjection.ServiceProviderServiceExtensions.GetRequiredService(IServiceProvider provider, Type serviceType)
Exception: Could not resolve a service of type 'Senparc.Weixin.Entities.ISenparcWeixinSettingForWxOpen' for the parameter 'senparcWeixinSetting' of method 'Configure' on type 'Ranwei.Web.Api.Startup'.
Microsoft.AspNetCore.Hosting.ConfigureBuilder.Invoke(object instance, IApplicationBuilder builder)
InvalidOperationException: No service for type 'Senparc.Weixin.Entities.ISenparcWeixinSettingForWxOpen' has been registered.
Microsoft.Extensions.DependencyInjection.ServiceProviderServiceExtensions.GetRequiredService(IServiceProvider provider, Type serviceType)
Microsoft.AspNetCore.Hosting.ConfigureBuilder.Invoke(object instance, IApplicationBuilder builder)

Show raw exception details
System.InvalidOperationException: No service for type 'Senparc.Weixin.Entities.ISenparcWeixinSettingForWxOpen' has been registered.
   at Microsoft.Extensions.DependencyInjection.ServiceProviderServiceExtensions.GetRequiredService(IServiceProvider provider, Type serviceType)
   at Microsoft.AspNetCore.Hosting.ConfigureBuilder.Invoke(Object instance, IApplicationBuilder builder)
Exception: Could not resolve a service of type 'Senparc.Weixin.Entities.ISenparcWeixinSettingForWxOpen' for the parameter 'senparcWeixinSetting' of method 'Configure' on type 'Ranwei.Web.Api.Startup'.
Microsoft.AspNetCore.Hosting.ConfigureBuilder.Invoke(object instance, IApplicationBuilder builder)
Microsoft.AspNetCore.Hosting.ConfigureBuilder+<>c__DisplayClass4_0.<Build>b__0(IApplicationBuilder builder)
Microsoft.AspNetCore.Hosting.GenericWebHostBuilder+<>c__DisplayClass15_0.<UseStartup>b__1(IApplicationBuilder app)
Microsoft.AspNetCore.Mvc.Filters.MiddlewareFilterBuilderStartupFilter+<>c__DisplayClass0_0.<Configure>g__MiddlewareFilterBuilder|0(IApplicationBuilder builder)
Microsoft.AspNetCore.Server.IIS.Core.IISServerSetupFilter+<>c__DisplayClass2_0.<Configure>b__0(IApplicationBuilder app)
Microsoft.AspNetCore.HostFilteringStartupFilter+<>c__DisplayClass0_0.<Configure>b__0(IApplicationBuilder app)
Furion.StartupFilter+<>c__DisplayClass0_0.<Configure>b__0(IApplicationBuilder app)
Microsoft.AspNetCore.Hosting.GenericWebHostService.StartAsync(CancellationToken cancellationToken)
Microsoft.Extensions.Hosting.Internal.Host.StartAsync(CancellationToken cancellationToken)
Microsoft.Extensions.Hosting.HostingAbstractionsHostExtensions.RunAsync(IHost host, CancellationToken token)
Microsoft.Extensions.Hosting.HostingAbstractionsHostExtensions.RunAsync(IHost host, CancellationToken token)
Microsoft.Extensions.Hosting.HostingAbstractionsHostExtensions.Run(IHost host)
Ranwei.Web.Api.Program.Main(string[] args) in Program.cs
+
       /// <summary>
       /// ������
       /// </summary>
       /// <param name="args"></param>
       public static void Main(string[] args)
       {
               CreateHostBuilder(args).Build().Run();
       }
       /// <summary>
       /// ������Ŀ�����ܵ�
       /// </summary>
       /// <param name="args"></param>
       /// <returns></returns>

Show raw exception details
System.Exception: Could not resolve a service of type 'Senparc.Weixin.Entities.ISenparcWeixinSettingForWxOpen' for the parameter 'senparcWeixinSetting' of method 'Configure' on type 'Ranwei.Web.Api.Startup'.
 ---> System.InvalidOperationException: No service for type 'Senparc.Weixin.Entities.ISenparcWeixinSettingForWxOpen' has been registered.
   at Microsoft.Extensions.DependencyInjection.ServiceProviderServiceExtensions.GetRequiredService(IServiceProvider provider, Type serviceType)
   at Microsoft.AspNetCore.Hosting.ConfigureBuilder.Invoke(Object instance, IApplicationBuilder builder)
   --- End of inner exception stack trace ---
   at Microsoft.AspNetCore.Hosting.ConfigureBuilder.Invoke(Object instance, IApplicationBuilder builder)
   at Microsoft.AspNetCore.Hosting.ConfigureBuilder.<>c__DisplayClass4_0.<Build>b__0(IApplicationBuilder builder)
   at Microsoft.AspNetCore.Hosting.GenericWebHostBuilder.<>c__DisplayClass15_0.<UseStartup>b__1(IApplicationBuilder app)
   at Microsoft.AspNetCore.Mvc.Filters.MiddlewareFilterBuilderStartupFilter.<>c__DisplayClass0_0.<Configure>g__MiddlewareFilterBuilder|0(IApplicationBuilder builder)
   at Microsoft.AspNetCore.Server.IIS.Core.IISServerSetupFilter.<>c__DisplayClass2_0.<Configure>b__0(IApplicationBuilder app)
   at Microsoft.AspNetCore.HostFilteringStartupFilter.<>c__DisplayClass0_0.<Configure>b__0(IApplicationBuilder app)
   at Furion.StartupFilter.<>c__DisplayClass0_0.<Configure>b__0(IApplicationBuilder app)
   at Microsoft.AspNetCore.Hosting.GenericWebHostService.StartAsync(CancellationToken cancellationToken)
   at Microsoft.Extensions.Hosting.Internal.Host.StartAsync(CancellationToken cancellationToken)
   at Microsoft.Extensions.Hosting.HostingAbstractionsHostExtensions.RunAsync(IHost host, CancellationToken token)
   at Microsoft.Extensions.Hosting.HostingAbstractionsHostExtensions.RunAsync(IHost host, CancellationToken token)
   at Microsoft.Extensions.Hosting.HostingAbstractionsHostExtensions.Run(IHost host)
   at Ranwei.Web.Api.Program.Main(String[] args) in H:\NetProject\车有缘\develop\Web\Ranwei.Web.Api\Program.cs:line 17
.NET 5.0.0 X64 v5.0.0.0    |   Microsoft.AspNetCore.Hosting version 5.0.0+371a26f07b23ad77c636332c2dfc0cbd1d8137ba    |    Microsoft Windows 10.0.19042    |   Need help?


陈年椰子 T0 发布于4个月前

最佳解决方案

原因分析

依赖注入的相应服务访问不多 或者有报错

进入Startup.cs  ,进入方法ConfigureServices 和 Configure ,检查相应注册服务代码 ,先注销掉相应注册,确定下应用能否正常启动。

如果可以正常启动了,就是相应的服务类有报错,或者 访问不到,进行下单元测试,确保服务可以正常运行,再注入到应用中



java喵~ T0 被采纳率100%
2021-08-09 09:29
打赏 0 1
页面统计
400 访问
0 帮助
0.00 打赏

hierror 2019 © hierror.com 京ICP备13026190号-1

通知消息
  • 暂无任何消息