Could not load file or assembly

This topic was automatically closed 365 days after the last reply. New replies are no longer allowed.
5 years ago
Hi

I have been running nop 4.0 for some time on a server now.
I then upgraded one of my plugins (Nop.Plugin.Api) which afterwards failed on load.
I have now removed that folder but now I cant start my website at all.
It throws errors like 'Could not load file or assembly 'Microsoft.AspNet.WebHooks.Custom'
Does anyone know why the site suddenly cannot load the assemblies?

Complete error:


Application startup exception: System.Reflection.ReflectionTypeLoadException: Unable to load one or more of the requested types. Retrieve the LoaderExceptions property for more information.
   at System.Reflection.RuntimeModule.GetTypes(RuntimeModule module)
   at System.Reflection.RuntimeAssembly.get_DefinedTypes()
   at AutoMapper.ServiceCollectionExtensions.<>c.<AddAutoMapperClasses>b__11_1(Assembly a)
   at System.Linq.Enumerable.<SelectManyIterator>d__17`2.MoveNext()
   at System.Linq.Buffer`1..ctor(IEnumerable`1 source)
   at System.Linq.Enumerable.ToArray[TSource](IEnumerable`1 source)
   at AutoMapper.ServiceCollectionExtensions.AddAutoMapperClasses(IServiceCollection services, Action`1 additionalInitAction, IEnumerable`1 assembliesToScan)
   at AutoMapper.ServiceCollectionExtensions.AddAutoMapper(IServiceCollection services)
   at Nop.Core.Infrastructure.NopEngine.AddAutoMapper(IServiceCollection services, ITypeFinder typeFinder) in E:\nopCommerce\downloads.nopcommerce.com\nopCommerce_4.00_Source\Libraries\Nop.Core\Infrastructure\NopEngine.cs:line 123
   at Nop.Core.Infrastructure.NopEngine.ConfigureServices(IServiceCollection services, IConfigurationRoot configuration) in E:\nopCommerce\downloads.nopcommerce.com\nopCommerce_4.00_Source\Libraries\Nop.Core\Infrastructure\NopEngine.cs:line 197
   at Nop.Web.Framework.Infrastructure.Extensions.ServiceCollectionExtensions.ConfigureApplicationServices(IServiceCollection services, IConfigurationRoot configuration) in E:\nopCommerce\downloads.nopcommerce.com\nopCommerce_4.00_Source\Presentation\Nop.Web.Framework\Infrastructure\Extensions\ServiceCollectionExtensions.cs:line 51
   at Nop.Web.Startup.ConfigureServices(IServiceCollection services) in E:\nopCommerce\downloads.nopcommerce.com\nopCommerce_4.00_Source\Presentation\Nop.Web\Startup.cs:line 44
--- End of stack trace from previous location where exception was thrown ---
   at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()
   at Microsoft.AspNetCore.Hosting.ConventionBasedStartup.ConfigureServices(IServiceCollection services)
   at Microsoft.AspNetCore.Hosting.Internal.WebHost.EnsureApplicationServices()
   at Microsoft.AspNetCore.Hosting.Internal.WebHost.BuildApplication()
crit: Microsoft.AspNetCore.Hosting.Internal.WebHost[6]
      Application startup exception
      Could not load file or assembly 'Microsoft.AspNet.WebHooks.Custom, Version=1.2.1.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35' or one of its dependencies. The system cannot find the file specified.
      Could not load file or assembly 'Microsoft.AspNet.WebHooks.Custom, Version=1.2.1.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35' or one of its dependencies. The system cannot find the file specified.
      Could not load file or assembly 'Microsoft.AspNet.WebHooks.Common, Version=1.2.1.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35' or one of its dependencies. The system cannot find the file specified.
      Could not load file or assembly 'IdentityServer4, Version=2.0.3.0, Culture=neutral, PublicKeyToken=null' or one of its dependencies. The system cannot find the file specified.
      Could not load file or assembly 'Microsoft.EntityFrameworkCore.Relational, Version=2.0.1.0, Culture=neutral, PublicKeyToken=adb9793829ddae60' or one of its dependencies. The system cannot find the file specified.
      Could not load file or assembly 'Microsoft.EntityFrameworkCore.Relational, Version=2.0.1.0, Culture=neutral, PublicKeyToken=adb9793829ddae60' or one of its dependencies. The system cannot find the file specified.
      Could not load file or assembly 'Microsoft.EntityFrameworkCore.Relational, Version=2.0.1.0, Culture=neutral, PublicKeyToken=adb9793829ddae60' or one of its dependencies. The system cannot find the file specified.
      Could not load file or assembly 'Microsoft.EntityFrameworkCore.Relational, Version=2.0.1.0, Culture=neutral, PublicKeyToken=adb9793829ddae60' or one of its dependencies. The system cannot find the file specified.
      Could not load file or assembly 'Microsoft.EntityFrameworkCore.Relational, Version=2.0.1.0, Culture=neutral, PublicKeyToken=adb9793829ddae60' or one of its dependencies. The system cannot find the file specified.
      Could not load file or assembly 'IdentityServer4, Version=2.0.3.0, Culture=neutral, PublicKeyToken=null' or one of its dependencies. The system cannot find the file specified.
      Could not load file or assembly 'IdentityServer4, Version=2.0.3.0, Culture=neutral, PublicKeyToken=null' or one of its dependencies. The system cannot find the file specified.
      Could not load file or assembly 'IdentityServer4, Version=2.0.3.0, Culture=neutral, PublicKeyToken=null' or one of its dependencies. The system cannot find the file specified.
      Could not load file or assembly 'IdentityServer4, Version=2.0.3.0, Culture=neutral, PublicKeyToken=null' or one of its dependencies. The system cannot find the file specified.
      Could not load file or assembly 'IdentityServer4, Version=2.0.3.0, Culture=neutral, PublicKeyToken=null' or one of its dependencies. The system cannot find the file specified.
      Could not load file or assembly 'IdentityServer4, Version=2.0.3.0, Culture=neutral, PublicKeyToken=null' or one of its dependencies. The system cannot find the file specified.
      Could not load file or assembly 'IdentityServer4, Version=2.0.3.0, Culture=neutral, PublicKeyToken=null' or one of its dependencies. The system cannot find the file specified.
      Could not load file or assembly 'IdentityServer4, Version=2.0.3.0, Culture=neutral, PublicKeyToken=null' or one of its dependencies. The system cannot find the file specified.
      Could not load file or assembly 'IdentityServer4, Version=2.0.3.0, Culture=neutral, PublicKeyToken=null' or one of its dependencies. The system cannot find the file specified.
      Could not load file or assembly 'IdentityServer4, Version=2.0.3.0, Culture=neutral, PublicKeyToken=null' or one of its dependencies. The system cannot find the file specified.
      Could not load file or assembly 'IdentityServer4, Version=2.0.3.0, Culture=neutral, PublicKeyToken=null' or one of its dependencies. The system cannot find the file specified.
      Could not load file or assembly 'IdentityServer4, Version=2.0.3.0, Culture=neutral, PublicKeyToken=null' or one of its dependencies. The system cannot find the file specified.
      Could not load file or assembly 'IdentityServer4, Version=2.0.3.0, Culture=neutral, PublicKeyToken=null' or one of its dependencies. The system cannot find the file specified.
      Could not load file or assembly 'IdentityServer4, Version=2.0.3.0, Culture=neutral, PublicKeyToken=null' or one of its dependencies. The system cannot find the file specified.
      Could not load file or assembly 'IdentityServer4, Version=2.0.3.0, Culture=neutral, PublicKeyToken=null' or one of its dependencies. The system cannot find the file specified.
      Could not load file or assembly 'IdentityServer4, Version=2.0.3.0, Culture=neutral, PublicKeyToken=null' or one of its dependencies. The system cannot find the file specified.
      Could not load file or assembly 'IdentityServer4, Version=2.0.3.0, Culture=neutral, PublicKeyToken=null' or one of its dependencies. The system cannot find the file specified.
      Could not load file or assembly 'Microsoft.AspNet.WebHooks.Custom, Version=1.2.1.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35' or one of its dependencies. The system cannot find the file specified.
      Could not load file or assembly 'Microsoft.AspNet.WebHooks.Custom, Version=1.2.1.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35' or one of its dependencies. The system cannot find the file specified.
      Could not load file or assembly 'Microsoft.AspNet.WebHooks.Custom, Version=1.2.1.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35' or one of its dependencies. The system cannot find the file specified.
      Could not load file or assembly 'Microsoft.AspNet.WebHooks.Custom, Version=1.2.1.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35' or one of its dependencies. The system cannot find the file specified.
      Could not load file or assembly 'Microsoft.AspNet.WebHooks.Custom, Version=1.2.1.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35' or one of its dependencies. The system cannot find the file specified.
      Could not load file or assembly 'Microsoft.AspNet.WebHooks.Custom, Version=1.2.1.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35' or one of its dependencies. The system cannot find the file specified.
      Could not load file or assembly 'Microsoft.AspNet.WebHooks.Custom, Version=1.2.1.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35' or one of its dependencies. The system cannot find the file specified.
System.Reflection.ReflectionTypeLoadException: Unable to load one or more of the requested types. Retrieve the LoaderExceptions property for more information.
   at System.Reflection.RuntimeModule.GetTypes(RuntimeModule module)
   at System.Reflection.RuntimeAssembly.get_DefinedTypes()
   at AutoMapper.ServiceCollectionExtensions.<>c.<AddAutoMapperClasses>b__11_1(Assembly a)
   at System.Linq.Enumerable.<SelectManyIterator>d__17`2.MoveNext()
   at System.Linq.Buffer`1..ctor(IEnumerable`1 source)
   at System.Linq.Enumerable.ToArray[TSource](IEnumerable`1 source)
   at AutoMapper.ServiceCollectionExtensions.AddAutoMapperClasses(IServiceCollection services, Action`1 additionalInitAction, IEnumerable`1 assembliesToScan)
   at AutoMapper.ServiceCollectionExtensions.AddAutoMapper(IServiceCollection services)
   at Nop.Core.Infrastructure.NopEngine.AddAutoMapper(IServiceCollection services, ITypeFinder typeFinder) in E:\nopCommerce\downloads.nopcommerce.com\nopCommerce_4.00_Source\Libraries\Nop.Core\Infrastructure\NopEngine.cs:line 123
   at Nop.Core.Infrastructure.NopEngine.ConfigureServices(IServiceCollection services, IConfigurationRoot configuration) in E:\nopCommerce\downloads.nopcommerce.com\nopCommerce_4.00_Source\Libraries\Nop.Core\Infrastructure\NopEngine.cs:line 197
   at Nop.Web.Framework.Infrastructure.Extensions.ServiceCollectionExtensions.ConfigureApplicationServices(IServiceCollection services, IConfigurationRoot configuration) in E:\nopCommerce\downloads.nopcommerce.com\nopCommerce_4.00_Source\Presentation\Nop.Web.Framework\Infrastructure\Extensions\ServiceCollectionExtensions.cs:line 51
   at Nop.Web.Startup.ConfigureServices(IServiceCollection services) in E:\nopCommerce\downloads.nopcommerce.com\nopCommerce_4.00_Source\Presentation\Nop.Web\Startup.cs:line 44
--- End of stack trace from previous location where exception was thrown ---
   at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()
   at Microsoft.AspNetCore.Hosting.ConventionBasedStartup.ConfigureServices(IServiceCollection services)
   at Microsoft.AspNetCore.Hosting.Internal.WebHost.EnsureApplicationServices()
   at Microsoft.AspNetCore.Hosting.Internal.WebHost.BuildApplication()
Hosting environment: Production
5 years ago
Hi.

One time I had the same problem.

I leave my comment in case your case still persists.

There are two interesting folders:
... \ nopCommerce_4.00_Source \ Presentation \ Nop.Web \ Plugins \ Bin
... \ nopCommerce_4.00_Source \ Presentation \ Nop.Web \ Plugins \ Nop.Plugin.Api

They are where it puts the DLLs for each plugin, and some dlls comunies.


In my case and I think that is your case, the versions of the DLLs do not match.

The Nop.Core.Plugins.PluginManager, decides if the dll that is going to be used already exists in the general project, then omits it. and that's why he does not find it.

Check that in ALL the projects of the solution you have the same versions of the DLLs

In your case all that your log says.
Microsoft.AspNet.WebHooks.Custom Version = 1.2.1.0
Microsoft.EntityFrameworkCore.Relational, Version = 2.0.1.0
IdentityServer4, Version = 2.0.3.0
.......

Same Version in all projects

I hope my comment help
4 years ago
I had the same problem
You should add your packages through nuget.
then in your .cproj file of plugin

<CopyLocalLockFileAssemblies>true</CopyLocalLockFileAssemblies>


Let's looke here
https://github.com/nopSolutions/nopCommerce/issues/3208
This topic was automatically closed 365 days after the last reply. New replies are no longer allowed.