Geta / 404handler

The popular 404 handler for EPiServer, enabling better control over your 404 page in addition to allowing redirects for old urls that no longer works.
Apache License 2.0
54 stars 51 forks source link

Episerver 11.5.3 Yellowscreen #116

Closed MarioToronti closed 6 years ago

MarioToronti commented 6 years ago

I updated episerver to 11.5.3 and I get a yellow screen when trying to load Commerce Manager. With the error below:

While loading .NET types from "BVNetwork.EPi404" the following error(s) was reported:

- System.TypeLoadException: Could not load type 'EPiServer.SimplePage' from assembly 'EPiServer, Version=11.5.3.0, Culture=neutral, PublicKeyToken=8fe83dea738b45b7'.
- System.TypeLoadException: Could not load type 'EPiServer.Framework.IInitializableHttpModule' from assembly 'EPiServer.Framework, Version=11.5.3.0, Culture=neutral, PublicKeyToken=8fe83dea738b45b7'.

Stack trace:

[InitializationException: While loading .NET types from "BVNetwork.EPi404" the following error(s) was reported:

     - System.TypeLoadException: Could not load type 'EPiServer.SimplePage' from assembly 'EPiServer, Version=11.5.3.0, Culture=neutral, PublicKeyToken=8fe83dea738b45b7'.
     - System.TypeLoadException: Could not load type 'EPiServer.Framework.IInitializableHttpModule' from assembly 'EPiServer.Framework, Version=11.5.3.0, Culture=neutral, PublicKeyToken=8fe83dea738b45b7'.

]
   EPiServer.Framework.Initialization.Internal.InitializationExceptionHelper.ThrowFriendlyTypeScannerException(IEnumerable`1 reflectionExceptions, IEnumerable`1 addonsWithErrors) +114
   EPiServer.Framework.Initialization.InitializationModule.EngineExecute(HostType hostType, Action`1 engineAction) +1347
   EPiServer.Framework.Initialization.InitializationModule.FrameworkInitialization(HostType hostType) +225
   EPiServer.Global..ctor() +103
   ASP.global_asax..ctor() in c:\Windows\Microsoft.NET\Framework64\v4.0.30319\Temporary ASP.NET Files\root\6ad79c2f\836b8a2c\App_global.asax.hyulgj-w.0.cs:0

[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) +139
   System.Activator.CreateInstance(Type type, Boolean nonPublic) +105
   System.RuntimeType.CreateInstanceImpl(BindingFlags bindingAttr, Binder binder, Object[] args, CultureInfo culture, Object[] activationAttributes, StackCrawlMark& stackMark) +1431
   System.Activator.CreateInstance(Type type, BindingFlags bindingAttr, Binder binder, Object[] args, CultureInfo culture, Object[] activationAttributes) +184
   System.Activator.CreateInstance(Type type, BindingFlags bindingAttr, Binder binder, Object[] args, CultureInfo culture) +27
   System.Web.HttpRuntime.CreateNonPublicInstance(Type type, Object[] args) +79
   System.Web.HttpApplicationFactory.GetSpecialApplicationInstance(IntPtr appContext, HttpContext context) +262
   System.Web.Hosting.PipelineRuntime.InitializeApplication(IntPtr appContext) +341

[HttpException (0x80004005): Exception has been thrown by the target of an invocation.]
   System.Web.HttpRuntime.FirstRequestInit(HttpContext context) +523
   System.Web.HttpRuntime.EnsureFirstRequestInit(HttpContext context) +107
   System.Web.HttpRuntime.ProcessRequestNotificationPrivate(IIS7WorkerRequest wr, HttpContext context) +688
marisks commented 6 years ago

Which version of the 404 handler do you use?

MarioToronti commented 6 years ago

I was having this error with 11.0.0 and so I updated to the latest one 11.1.12 but still getting the error.

marisks commented 6 years ago

Do you have assembly bindings set correctly for these Episerver assemblies?

MarioToronti commented 6 years ago

This is from my .csproj file (I don't know why it's version:1.0.0.0):

<Reference Include="BVNetwork.EPi404, Version=1.0.0.0, Culture=neutral, processorArchitecture=MSIL">
      <HintPath>..\packages\BVN.404Handler.11.1.12\lib\net461\BVNetwork.EPi404.dll</HintPath>
    </Reference>

And this from web.config: <section name="bvn404Handler" type="BVNetwork.NotFound.Configuration.Bvn404HandlerConfiguration, BVNetwork.EPi404" />

I also added everything mentioned in configuration

I found out that both these assemblies were moved from EPiServer.Framework to EPiServer.Framework.AspNet. I think this is why they can't be found.

marisks commented 6 years ago

Have you tried to clean ASP.NET cache? The path: C:\Windows\Microsoft.NET\Framework64\v4.0.30319\Temporary ASP.NET Files

MarioToronti commented 6 years ago

Didn't work. Neither empting bin folder and restarting VS

MarioToronti commented 6 years ago

Thanks for the help! :) I managed to solve this problem. After deleting BVNetwork.EPi404.dll from Commerce Manager's bin folder, I got a new error Value cannot be null.Parameter name: virtualPath]in EPiServer.Shell.ShellInitialization.WaitForInitializeModules()

which got solved by restoring removed episerver.shell web.config entries after commerce update, as mentioned here