“Abp.AbpBootstrapper – System.MissingMethodException: Method not found: Void Abp.Configuration.SettingDefinition..ctor”的解决方案

“Abp.AbpBootstrapper - System.MissingMethodException: Method not found: Void Abp.Configuration.SettingDefinition..ctor”的解决方案

文章目录

描述

最近在使用 abp 框架启动项目时,遇到如下的报错信息:

FATAL 2020-06-06 22:40:30,900 [1    ] Abp.AbpBootstrapper                      - System.MissingMethodException: Method not found: 'Void Abp.Configuration.SettingDefinition..ctor(System.String, System.String, Abp.Localization.ILocalizableString, Abp.Configuration.SettingDefinitionGroup, Abp.Localization.ILocalizableString, Abp.Configuration.SettingScopes, Boolean, Boolean, System.Object, Abp.Configuration.ISettingClientVisibilityProvider)'.
   at Abp.Zero.Configuration.AbpZeroSettingProvider.GetSettingDefinitions(SettingDefinitionProviderContext context)
   at Abp.Configuration.SettingDefinitionManager.Initialize()
   at Abp.AbpKernelModule.PostInitialize()
   at Abp.Modules.AbpModuleManager.<>c.<StartModules>b__15_2(AbpModuleInfo module)
   at System.Collections.Generic.List1.ForEach(Action1 action)
   at Abp.Modules.AbpModuleManager.StartModules()
   at Abp.AbpBootstrapper.Initialize()
System.MissingMethodException: Method not found: 'Void Abp.Configuration.SettingDefinition..ctor(System.String, System.String, Abp.Localization.ILocalizableString, Abp.Configuration.SettingDefinitionGroup, Abp.Localization.ILocalizableString, Abp.Configuration.SettingScopes, Boolean, Boolean, System.Object, Abp.Configuration.ISettingClientVisibilityProvider)'.
   at Abp.Zero.Configuration.AbpZeroSettingProvider.GetSettingDefinitions(SettingDefinitionProviderContext context)
   at Abp.Configuration.SettingDefinitionManager.Initialize()
   at Abp.AbpKernelModule.PostInitialize()
   at Abp.Modules.AbpModuleManager.<>c.<StartModules>b__15_2(AbpModuleInfo module)
   at System.Collections.Generic.List1.ForEach(Action1 action)
   at Abp.Modules.AbpModuleManager.StartModules()
   at Abp.AbpBootstrapper.Initialize()
FATAL 2020-06-06 22:40:30,917 [1    ] Microsoft.AspNetCore.Hosting.WebHost     - Application startup exception
System.MissingMethodException: Method not found: 'Void Abp.Configuration.SettingDefinition..ctor(System.String, System.String, Abp.Localization.ILocalizableString, Abp.Configuration.SettingDefinitionGroup, Abp.Localization.ILocalizableString, Abp.Configuration.SettingScopes, Boolean, Boolean, System.Object, Abp.Configuration.ISettingClientVisibilityProvider)'.
   at Abp.Zero.Configuration.AbpZeroSettingProvider.GetSettingDefinitions(SettingDefinitionProviderContext context)
   at Abp.Configuration.SettingDefinitionManager.Initialize()
   at Abp.AbpKernelModule.PostInitialize()
   at Abp.Modules.AbpModuleManager.<>c.<StartModules>b__15_2(AbpModuleInfo module)
   at System.Collections.Generic.List1.ForEach(Action1 action)
   at Abp.Modules.AbpModuleManager.StartModules()
   at Abp.AbpBootstrapper.Initialize()
   at Abp.AspNetCore.AbpApplicationBuilderExtensions.InitializeAbp(IApplicationBuilder app)
   at Abp.AspNetCore.AbpApplicationBuilderExtensions.UseAbp(IApplicationBuilder app, Action`1 optionsAction)
   at ByteFlying.SEOS.Web.Host.Startup.Startup.Configure(IApplicationBuilder app, ILoggerFactory loggerFactory) in C:\Users\Administrator\Desktop\respo\xxx\aspnet-core\src\xxx.xxx.Web.Host\Startup\Startup.cs:line 116
   at System.RuntimeMethodHandle.InvokeMethod(Object target, Object[] arguments, Signature sig, Boolean constructor, Boolean wrapExceptions)
   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.Hosting.ConfigureBuilder.<>c__DisplayClass4_0.<Build>b__0(IApplicationBuilder builder)
   at Microsoft.AspNetCore.Hosting.ConventionBasedStartup.Configure(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 Microsoft.AspNetCore.Hosting.WebHost.BuildApplication()

解决

发生这个问题的原因是,项目中不同的程序集中所引用的 abp 包版本不一致。逐一检查所有的程序集,确定引用的 abp 包是否版本号一致,另外注意第三方 abp 集成包(如第三方封装的后台任务 HangFire 包)所对应的版本号是否和你的项目的主 abp 包相同。

本文由 .Net中文网 原创发布,欢迎大家踊跃转载。

转载请注明本文地址:https://www.byteflying.com/archives/3632

发表评论

登录后才能评论