0

I am using Sitecore 9.1 and Sitecore Commerce 9.1. When I hit https://projectname.dev.local/sitecore/login, it keeps loading and in commerce authoring logs I can see following exception -

System.AggregateException: One or more errors occurred. ---> System.TypeInitializationException: The type initializer for 'Microsoft.AspNetCore.OData.Builder.ODataModelBuilder' threw an exception. ---> System.TypeLoadException: Could not load type 'Microsoft.OData.Edm.Library.EdmConstants' from assembly 'Microsoft.OData.Edm, Version=7.5.0.20627, Culture=neutral, PublicKeyToken=31bf3856ad364e35'.
   at Microsoft.AspNetCore.OData.Builder.ODataModelBuilder..cctor()
   --- End of inner exception stack trace ---
   at Microsoft.AspNetCore.OData.Builder.ODataModelBuilder..ctor()
   at Microsoft.AspNetCore.OData.Builder.ODataConventionModelBuilder..ctor()
   at Sitecore.Commerce.Engine.Startup.<>c__DisplayClass14_0.<Configure>b__4()
   at System.Threading.Tasks.Task`1.InnerInvoke()
   at System.Threading.Tasks.Task.Execute()
   --- End of inner exception stack trace ---
   at System.Threading.Tasks.Task`1.GetResultCore(Boolean waitCompletionNotification)
   at Sitecore.Commerce.Engine.Startup.Configure(IApplicationBuilder app, IConfigureServiceApiPipeline configureServiceApiPipeline, IStartNodePipeline startNodePipeline, IConfigureOpsServiceApiPipeline configureOpsServiceApiPipeline, IStartEnvironmentPipeline startEnvironmentPipeline, ILoggerFactory loggerFactory, IOptions`1 loggingSettings, IOptions`1 applicationInsightsSettings, IOptions`1 certificatesSettings, IOptions`1 allowedOriginsOptions, GetDatabaseVersionCommand getDatabaseVersionCommand)
--- End of stack trace from previous location where exception was thrown ---
   at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()
   at Microsoft.AspNetCore.Hosting.ConventionBasedStartup.Configure(IApplicationBuilder app)
   at Microsoft.AspNetCore.Hosting.Internal.WebHost.BuildApplication()
---> (Inner Exception #0) System.TypeInitializationException: The type initializer for 'Microsoft.AspNetCore.OData.Builder.ODataModelBuilder' threw an exception. ---> System.TypeLoadException: Could not load type 'Microsoft.OData.Edm.Library.EdmConstants' from assembly 'Microsoft.OData.Edm, Version=7.5.0.20627, Culture=neutral, PublicKeyToken=31bf3856ad364e35'.
   at Microsoft.AspNetCore.OData.Builder.ODataModelBuilder..cctor()
   --- End of inner exception stack trace ---
   at Microsoft.AspNetCore.OData.Builder.ODataModelBuilder..ctor()
   at Microsoft.AspNetCore.OData.Builder.ODataConventionModelBuilder..ctor()
   at Sitecore.Commerce.Engine.Startup.<>c__DisplayClass14_0.<Configure>b__4()
   at System.Threading.Tasks.Task`1.InnerInvoke()
   at System.Threading.Tasks.Task.Execute()<---

00005 15:39:59 INFO Request starting HTTP/1.1 GET http://commerceauthoring.projectname-sc911xc91xp0.dev.local/commerceops/GetCatalogMappings(environmentName='')  
00005 15:39:59 INFO Request finished in 82.1726ms 500 text/html; charset=utf-8

Please let me know how to resolve this. I am completely new to Sitecore xCommerce.

  • 1
    Do you have the assembly Microsoft.OData.Edm, Version=7.5.0.20627 defined in your config? There is a reference to that version which doesn't seem like that assembly is on the bin folder or if it is it will have a different version – Diego Sep 6 at 18:01
  • The error is resolved now, it was due to incompatible dlls. I reverted my changes and built and deployed fresh dlls. The page is working fine. Thank you @Diego ! – Nidhi Vaishnava Sep 9 at 4:39

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.