0

我试图将我的项目与 Sitecore 数据库同步,但是当我构建 Sitecore Learning(服装公司)提供的解决方案时,我的网站未加载并出现错误。在我尝试构建它之前它工作正常。

`Server Error in '/' Application.
Could not load type 'Sitecore.HealthCheck.DependencyInjection.HealthChecksBuilder' from assembly 'Sitecore.Kernel, Version=13.0.0.0, Culture=neutral, PublicKeyToken=null'.
Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code.

Exception Details: System.TypeLoadException: Could not load type 'Sitecore.HealthCheck.DependencyInjection.HealthChecksBuilder' from assembly 'Sitecore.Kernel, Version=13.0.0.0, Culture=neutral, PublicKeyToken=null'.

Source Error:

An unhandled exception was generated during the execution of the current web request. Information regarding the origin and location of the exception can be identified using the exception stack trace below.

Stack Trace:


[TypeLoadException: Could not load type 'Sitecore.HealthCheck.DependencyInjection.HealthChecksBuilder' from assembly 'Sitecore.Kernel, Version=13.0.0.0, Culture=neutral, PublicKeyToken=null'.]
   Sitecore.ContentSearch.SolrProvider.DependencyInjection.ContentSearchServicesConfigurator.AddContentSearchHealthChecks(IServiceCollection serviceCollection) +0
   Sitecore.DependencyInjection.BaseServicesConfiguratorFactory.Configure(IServiceCollection serviceCollection) +171
   Sitecore.DependencyInjection.BaseServicesConfiguratorFactory.Configure(IServiceCollection serviceCollection) +171
   Sitecore.DependencyInjection.BaseServiceProviderBuilder.ConfigureServiceCollection() +142
   Sitecore.DependencyInjection.ServiceLocator.ConfigureServiceProvider() +225
   Sitecore.DependencyInjection.ServiceLocator.get_ServiceProvider() +513
   Sitecore.DependencyInjection.SitecorePerRequestScopeModule..ctor() +13

[TargetInvocationException: Exception has been thrown by the target of an invocation.]
   System.RuntimeTypeHandle.CreateInstance(RuntimeType type, Boolean publicOnly, Boolean noCheck, Boolean& canBeCached, RuntimeMethodHandleInternal& ctor, Boolean& bNeedSecurityCheck) +0
   System.RuntimeType.CreateInstanceSlow(Boolean publicOnly, Boolean skipCheckThis, Boolean fillCache, StackCrawlMark& stackMark) +142
   System.Activator.CreateInstance(Type type, Boolean nonPublic) +107
   System.RuntimeType.CreateInstanceImpl(BindingFlags bindingAttr, Binder binder, Object[] args, CultureInfo culture, Object[] activationAttributes, StackCrawlMark& stackMark) +1476
   System.Activator.CreateInstance(Type type, BindingFlags bindingAttr, Binder binder, Object[] args, CultureInfo culture, Object[] activationAttributes) +186
   System.Activator.CreateInstance(Type type, BindingFlags bindingAttr, Binder binder, Object[] args, CultureInfo culture) +28
   System.Web.HttpRuntime.CreateNonPublicInstance(Type type, Object[] args) +80
   System.Web.HttpApplication.BuildIntegratedModuleCollection(List`1 moduleList) +234
   System.Web.HttpApplication.GetModuleCollection(IntPtr appContext) +1153
   System.Web.HttpApplication.RegisterEventSubscriptionsWithIIS(IntPtr appContext, HttpContext context, MethodInfo[] handlers) +139
   System.Web.HttpApplication.InitSpecial(HttpApplicationState state, MethodInfo[] handlers, IntPtr appContext, HttpContext context) +168
   System.Web.HttpApplicationFactory.GetSpecialApplicationInstance(IntPtr appContext, HttpContext context) +277
   System.Web.Hosting.PipelineRuntime.InitializeApplication(IntPtr appContext) +369

[HttpException (0x80004005): Exception has been thrown by the target of an invocation.]
   System.Web.HttpRuntime.FirstRequestInit(HttpContext context) +532
   System.Web.HttpRuntime.EnsureFirstRequestInit(HttpContext context) +111
   System.Web.HttpRuntime.ProcessRequestNotificationPrivate(IIS7WorkerRequest wr, HttpContext context) +724`
4

1 回答 1

1

查看错误,似乎 Sitecore.Kernel.dll 在您的网站 bin 中被替换为不同的版本,或者您的 web.config 文件被替换,这可能具有 Sitecore.kernel.dll 的不同程序集绑定版本信息。

我建议,在 dotpeek 中检查您原始网站 bin 中的 Sitecore.kernel.dll 版本。通过 Nuget 管理器在您的项目解决方案中更新此版本的 Sitecore.kernel.dll,或在您的托管 lib 文件夹或 DLL 位置文件夹中更新您的 DLL。

如果您有,请将解决方案 web.config 中的程序集绑定信息与原始 web.config 中的相同。

如果两个地方的 DLL 版本已经相同,则在 dotpeek 中加载 Sitecore.kernel.dll,检查类 Sitecore.HealthCheck.DependencyInjection.HealthChecksBuilder 是否存在。如果没有,则某些配置文件包含此类的条目。在 App_config 文件夹文件中搜索单词 HealthChecksBuilder,并评论您找到的设置并查看该站点是否已启动。

然后 VS 发布希望问题得到解决。

于 2021-08-08T18:14:55.117 回答