Assembly errors running on Azure

Angel Velazquez asked on October 17, 2023 18:44

Hi all,

We are currently facing the following issue after we deployed our Solution into Azure DevOps:

**Server Error in '/' Application.**

Could not load file or assembly 'CMS.Base, Version=13.0.0.0, Culture=neutral, PublicKeyToken=834b12a258f213f9' or one of its dependencies. The located assembly's manifest definition does not match the assembly reference. (Exception from HRESULT: 0x80131040)

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.IO.FileLoadException: Could not load file or assembly 'CMS.Base, Version=13.0.0.0, Culture=neutral, PublicKeyToken=834b12a258f213f9' or one of its dependencies. The located assembly's manifest definition does not match the assembly reference. (Exception from HRESULT: 0x80131040)

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.

Assembly Load Trace: The following information can be helpful to determine why the assembly 'CMS.Base, Version=13.0.0.0, Culture=neutral, PublicKeyToken=834b12a258f213f9' could not be loaded.

WRN: Assembly binding logging is turned OFF.
To enable assembly bind failure logging, set the registry value
[HKLM\Software\Microsoft\Fusion!EnableLog] (DWORD) to 1.
Note: There is some performance penalty associated with assembly bind failure logging.
To turn this feature off, remove the registry value [HKLM\Software\Microsoft\Fusion!EnableLog].

Full stack trace below:

[FileLoadException: Could not load file or assembly 'CMS.Base, Version=13.0.0.0, Culture=neutral, PublicKeyToken=834b12a258f213f9' or one of its dependencies. The located assembly's manifest definition does not match the assembly reference. (Exception from HRESULT: 0x80131040)]
System.ModuleHandle.ResolveMethod(RuntimeModule module, Int32 methodToken, IntPtr* typeInstArgs, Int32 typeInstCount, IntPtr* methodInstArgs, Int32 methodInstCount) +0
System.ModuleHandle.ResolveMethodHandleInternalCore(RuntimeModule module, Int32 methodToken, IntPtr[] typeInstantiationContext, Int32 typeInstCount, IntPtr[] methodInstantiationContext, Int32 methodInstCount) +162
System.ModuleHandle.ResolveMethodHandleInternal(RuntimeModule module, Int32 methodToken, RuntimeTypeHandle[] typeInstantiationContext, RuntimeTypeHandle[] methodInstantiationContext) +96
System.Reflection.CustomAttributeData..ctor(RuntimeModule scope, CustomAttributeRecord caRecord) +79
System.Reflection.CustomAttributeData.GetCustomAttributes(RuntimeModule module, Int32 tkTarget) +119
System.Reflection.CustomAttributeData.GetCustomAttributesInternal(RuntimeAssembly target) +83
CMS.Core.AssemblyDiscovery.IsAssemblyDiscoverable(Assembly assembly) +19
CMS.Core.AssemblyDiscovery.AddOnlyDiscoverableAssembly(ICollection`1 assemblies, Dictionary`2 preloadedAssemblies, AssemblyName assemblyName, String filePath) +72
CMS.Core.AssemblyDiscovery.ExecuteGetAssemblies(Boolean onlyDiscoverable) +1168
CMS.Core.AssemblyDiscovery.get_DiscoverableAssemblies() +31
CMS.Core.AssemblyDiscoveryHelper.GetAssemblies(Boolean discoverableOnly) +75
CMS.Core.ModuleDiscovery.GetModules() +99
CMS.Core.ModuleEntryManager.GetDiscoverableModules() +29
CMS.Core.ModuleEntryManager.ModuleCollectionsInitialization() +132
CMS.Core.ModuleEntryManager.PreInit() +21
CMS.Core.AppCore.PreInit() +133
CMS.DataEngine.CMSApplication.PreInit(Boolean initializeContainer) +127
Kentico.Web.Mvc.ApplicationBootstrapper.Run() +130
[InvalidOperationException: The pre-application start initialization method Run on type Kentico.Web.Mvc.ApplicationBootstrapper threw an exception with the following error message: Could not load file or assembly 'CMS.Base, Version=13.0.0.0, Culture=neutral, PublicKeyToken=834b12a258f213f9' or one of its dependencies. The located assembly's manifest definition does not match the assembly reference. (Exception from HRESULT: 0x80131040).]
System.Web.Compilation.BuildManager.InvokePreStartInitMethodsCore(ICollection`1 methods, Func`1 setHostingEnvironmentCultures) +919
System.Web.Compilation.BuildManager.InvokePreStartInitMethods(ICollection`1 methods) +169
System.Web.Compilation.BuildManager.CallPreStartInitMethods(String preStartInitListPath, Boolean& isRefAssemblyLoaded) +172
System.Web.Compilation.BuildManager.ExecutePreAppStart() +172
System.Web.Hosting.HostingEnvironment.Initialize(ApplicationManager appManager, IApplicationHost appHost, IConfigMapPathFactory configMapPathFactory, HostingEnvironmentParameters hostingParameters, PolicyLevel policyLevel, Exception appDomainCreationException) +854
[HttpException (0x80004005): The pre-application start initialization method Run on type Kentico.Web.Mvc.ApplicationBootstrapper threw an exception with the following error message: Could not load file or assembly 'CMS.Base, Version=13.0.0.0, Culture=neutral, PublicKeyToken=834b12a258f213f9' or one of its dependencies. The located assembly's manifest definition does not match the assembly reference. (Exception from HRESULT: 0x80131040).]
System.Web.HttpRuntime.FirstRequestInit(HttpContext context) +532
System.Web.HttpRuntime.EnsureFirstRequestInit(HttpContext context) +111
System.Web.HttpRuntime.ProcessRequestNotificationPrivate(IIS7WorkerRequest wr, HttpContext context) +724

Currently I have installed and/or updated to version 13.0.118...

By the way, My Website app runs perfectly in my local end.

I don't know what I have to do to fix this... Perhaps Should I try a restore of the DB on Azure??

I will appreciate your help so much! Thank you!

Recent Answers


Juraj Ondrus answered on October 18, 2023 06:02

I would try redepolying the project again. Making sure there are no old files left and then redeploy all the project files and DLLs again.

0 votesVote for this answer Mark as a Correct answer

Angel Velazquez answered on October 21, 2023 01:23 (last edited on October 21, 2023 01:24)

Hi Juraj,

I just realized that this issue is due to a Kentico.Xperience.Libraries, Kentico.Xperience.AspNet.Mvc5.Libraries and Kentico.Xperience.AspNet.Mvc5 updates:

The first version of our application was running on v.13.0.100, and once it was synchronized on Azure, it was running smoothly fine, but after we did an update from v.13.0.100 to v.13.0.118 we started to get this Error.

By the way, we didn't notice the issue before since when we run our application locally everything runs fine, means, without any error neither on CMSApp nor Website. The database we use to run the app locally is the same we have in Azure Portal. When we do a code rollback in Azure DevOps to the version that was working fine, we are able to see everything working fine once again, so to speak.

So what is your recommendation here?

We know that there are several dependencies that are updated alike.

  • Is this happen everytime one wants to update the Kentico Libraries versions?, If so, what a headache!
  • What are the main points we must keep special attention?, In order to achieve a quick troubleshoot and fix.
  • Or, What are the steps to follow after a version updating?

Thank You, Regards!

0 votesVote for this answer Mark as a Correct answer

Juraj Ondrus answered on October 23, 2023 06:08

I do not know how are you applying the hotfix and how are you deploying the newly hotfixed project and DB. If there was an issue in Kentico, I would expect to encounter some issues even locally. But if one environment works and other does not, then the issue is most likely in the deployment process or the target environment setup. And this is something I have no idea about, out of our control or scope.

0 votesVote for this answer Mark as a Correct answer

   Please, sign in to be able to submit a new answer.