Why do you think it's related with StructureMap? For me it seems that SiteAttention is failing to register itself in ModuleTable collection (or most probably EPiServer is failing to discover that module and register it in ModulesTable). Can you check access, permissions, etc.? Are other AddOns working?
Hi Valdis,
Now that you mention it, it is possible that it's unrelated to StructureMap. For the other problematic add-on (EPiServer Languages) StructureMap was in the exception stack trace but it's not in this case.
I have decompiled the EPiServer dll:s and the exception comes from EPiServer.Shell.Paths, a property called ToResource:
public static string ToResource(Assembly moduleAssembly, string moduleRelativeResourcePath) { ShellModule shellModule; if (moduleAssembly == null) { throw new ArgumentNullException("moduleAssembly", "Unable to resolve path to module resources folder by null assembly."); } if (!ServiceLocator.Current.GetInstance<ModuleTable>().TryGetModule(moduleAssembly, out shellModule)) { throw new ArgumentException(string.Concat("Unable to find a module by assembly '", moduleAssembly, "'"), "moduleAssembly"); } return ModuleTable.ResolvePath(shellModule, moduleRelativeResourcePath); }
So as you point out, it seems that the Add-on is indeed missing from ModuleTable. I'll continue to research how this may happen.
Emil
Sure, here we go:
[ArgumentException: Unable to find a module by assembly 'EPiServer.Labs.LanguageManager, Version=1.1.1.7514, Culture=neutral, PublicKeyToken=null' Parameter name: moduleAssembly] EPiServer.Shell.Paths.ToResource(Assembly moduleAssembly, String moduleRelativeResourcePath) +322 EPiServer.Labs.LanguageManager.LanguageManagerComponent..ctor() +202 [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) +147 System.Activator.CreateInstance(Type type, Boolean nonPublic) +104 System.Activator.CreateInstance(Type type) +12 EPiServer.Shell.ViewComposition.ComponentAttribute.CreateComponentDefinition(Type attributedType) +99 System.Linq.WhereSelectEnumerableIterator`2.MoveNext() +229 System.Collections.Generic.List`1..ctor(IEnumerable`1 collection) +538 System.Linq.Enumerable.ToList(IEnumerable`1 source) +73 EPiServer.Shell.ViewComposition.AttributedComponentProvider.GetComponentDefinitions() +310 EPiServer.Shell.ViewComposition.ComponentManager.ListAll() +256 EPiServer.Shell.ViewComposition.DefaultViewManager..ctor(IEnumerable`1 viewProviders, IEnumerable`1 viewTransformers, IComponentManager componentManager) +44 lambda_method(Closure , IArguments ) +236 StructureMap.Construction.<>c__DisplayClass2.<CreateBuilder>b__0(IArguments args) in c:\BuildAgent\work\767273992e840853\src\StructureMap\Construction\BuilderCompiler.cs:56 StructureMap.Pipeline.ConstructorInstance.Build(Type pluginType, BuildSession session, IInstanceBuilder builder) in c:\BuildAgent\work\767273992e840853\src\StructureMap\Pipeline\ConstructorInstance.cs:233 [StructureMapException: StructureMap Exception Code: 207 Internal exception while creating Instance '3e3d3525-c286-4099-baa9-be49757b1743' of PluginType EPiServer.Shell.ViewComposition.IViewManager. Check the inner exception for more details.] StructureMap.Pipeline.ConstructorInstance.Build(Type pluginType, BuildSession session, IInstanceBuilder builder) in c:\BuildAgent\work\767273992e840853\src\StructureMap\Pipeline\ConstructorInstance.cs:245 StructureMap.Pipeline.Instance.createRawObject(Type pluginType, BuildSession session) in c:\BuildAgent\work\767273992e840853\src\StructureMap\Pipeline\Instance.cs:103 StructureMap.Pipeline.Instance.Build(Type pluginType, BuildSession session) in c:\BuildAgent\work\767273992e840853\src\StructureMap\Pipeline\Instance.cs:69 StructureMap.Pipeline.ObjectBuilder.Resolve(Type pluginType, Instance instance, BuildSession session) in c:\BuildAgent\work\767273992e840853\src\StructureMap\Pipeline\ObjectBuilder.cs:27 StructureMap.BuildSession.CreateInstance(Type pluginType, Instance instance) in c:\BuildAgent\work\767273992e840853\src\StructureMap\BuildSession.cs:176 StructureMap.Pipeline.Instance.createRawObject(Type pluginType, BuildSession session) in c:\BuildAgent\work\767273992e840853\src\StructureMap\Pipeline\Instance.cs:103 StructureMap.Pipeline.Instance.Build(Type pluginType, BuildSession session) in c:\BuildAgent\work\767273992e840853\src\StructureMap\Pipeline\Instance.cs:69 StructureMap.Pipeline.ConstructorInstance.Get(String propertyName, BuildSession session) in c:\BuildAgent\work\767273992e840853\src\StructureMap\Pipeline\ConstructorInstance.cs:79 lambda_method(Closure , IArguments ) +59 StructureMap.Construction.<>c__DisplayClass2.<CreateBuilder>b__0(IArguments args) in c:\BuildAgent\work\767273992e840853\src\StructureMap\Construction\BuilderCompiler.cs:56 StructureMap.Pipeline.ConstructorInstance.Build(Type pluginType, BuildSession session, IInstanceBuilder builder) in c:\BuildAgent\work\767273992e840853\src\StructureMap\Pipeline\ConstructorInstance.cs:237 StructureMap.Pipeline.SmartInstance`1.build(Type pluginType, BuildSession session) in c:\BuildAgent\work\767273992e840853\src\StructureMap\Pipeline\SmartInstance.cs:156 StructureMap.Pipeline.Instance.createRawObject(Type pluginType, BuildSession session) in c:\BuildAgent\work\767273992e840853\src\StructureMap\Pipeline\Instance.cs:103 StructureMap.Pipeline.Instance.Build(Type pluginType, BuildSession session) in c:\BuildAgent\work\767273992e840853\src\StructureMap\Pipeline\Instance.cs:69 StructureMap.Pipeline.ObjectBuilder.Resolve(Type pluginType, Instance instance, BuildSession session) in c:\BuildAgent\work\767273992e840853\src\StructureMap\Pipeline\ObjectBuilder.cs:27 StructureMap.BuildSession.CreateInstance(Type pluginType, Instance instance) in c:\BuildAgent\work\767273992e840853\src\StructureMap\BuildSession.cs:176 StructureMap.Pipeline.Instance.createRawObject(Type pluginType, BuildSession session) in c:\BuildAgent\work\767273992e840853\src\StructureMap\Pipeline\Instance.cs:103 StructureMap.Pipeline.Instance.Build(Type pluginType, BuildSession session) in c:\BuildAgent\work\767273992e840853\src\StructureMap\Pipeline\Instance.cs:69 StructureMap.Pipeline.ConstructorInstance.Get(String propertyName, BuildSession session) in c:\BuildAgent\work\767273992e840853\src\StructureMap\Pipeline\ConstructorInstance.cs:79 lambda_method(Closure , IArguments ) +118 StructureMap.Construction.<>c__DisplayClass2.<CreateBuilder>b__0(IArguments args) in c:\BuildAgent\work\767273992e840853\src\StructureMap\Construction\BuilderCompiler.cs:56 StructureMap.Pipeline.ConstructorInstance.Build(Type pluginType, BuildSession session, IInstanceBuilder builder) in c:\BuildAgent\work\767273992e840853\src\StructureMap\Pipeline\ConstructorInstance.cs:237 StructureMap.Pipeline.Instance.createRawObject(Type pluginType, BuildSession session) in c:\BuildAgent\work\767273992e840853\src\StructureMap\Pipeline\Instance.cs:103 StructureMap.Pipeline.Instance.Build(Type pluginType, BuildSession session) in c:\BuildAgent\work\767273992e840853\src\StructureMap\Pipeline\Instance.cs:69 StructureMap.Pipeline.ObjectBuilder.Resolve(Type pluginType, Instance instance, BuildSession session) in c:\BuildAgent\work\767273992e840853\src\StructureMap\Pipeline\ObjectBuilder.cs:27 StructureMap.BuildSession.CreateInstance(Type pluginType, Instance instance) in c:\BuildAgent\work\767273992e840853\src\StructureMap\BuildSession.cs:176 EPiServer.ServiceLocation.ServiceLocatorImplBase.GetInstance(Type serviceType, String key) +55 [ActivationException: Activation error occurred while trying to get instance of type EPiDashboardController, key ""] EPiServer.ServiceLocation.ServiceLocatorImplBase.GetInstance(Type serviceType, String key) +156 EPiServer.Shell.Web.Mvc.ModuleControllerFactory.CreateController(RequestContext requestContext, String controllerName) +347 EPiServer.Shell.Web.Mvc.ModuleMvcHandler.ProcessRequestInit(HttpContextBase httpContext) +104 EPiServer.Shell.Web.Mvc.ModuleMvcHandler.BeginProcessRequest(HttpContextBase httpContext, AsyncCallback callback, Object state) +17 System.Web.CallHandlerExecutionStep.System.Web.HttpApplication.IExecutionStep.Execute() +932 System.Web.HttpApplication.ExecuteStep(IExecutionStep step, Boolean& completedSynchronously) +159
Thinking about it, I suspect the problem is probably very similar to the one for SiteAttention although the stack trace is much deeper this time.
/Emil
Seems like the problem is exactly the same. Just this time creation of type happens to be through StructureMap.
This is really fun to come back to the topic where you have commented a while ago :)
Anyway, just got a support case with excatly the same symptons as here. 7.5 site with language manager addon installed. Site failed to load.
After a while debugging and tracing found out that explicitly version 1.1.1.7514 has a small issue with packaging and modules.config file.
Problem is that modules.config file is not part of addon .zip package file (EPiServer.Labs.LanguageManager.zip). It's added to the root under modules/_protected/EPiServer.Labs.LanguageManager. If you modify .zip file and copy modules.config file just directly into .zip file. Site loads up, and EPiServer is able to find this module by assembly. Under the hood: EPiServer was able to find module and register it in its internal modules table, but there was no modules.config file for this module (because EPiServer looks under /cms/EPiServer.Labs.LanguageManager path that mapped via ModuleZipVirtualFileProvider or similar type). If EPiServer is not able to find this module.config file, module is still registered, but associated assembly is not added to the module list. Basically EPiServer is losing this fragment:
<assemblies> <add assembly="EPiServer.Labs.LanguageManager" /> </assemblies>
Next thing was -> gadget was now available for editors, but it was empty. Gadget content was not loaded.
After grepping log files, found out that EPiServer was not able to find /cms/EPiServer.Labs.LanguageManager/EPiServer.LanguageManager.config file. IO excpetion.
Looking at source code found out that module is mapping virtual file from module relative path - basically skipping zip virtual file provider and asking IIS directly to return this file path in order to open it up and read module settings. Of course IIS can return direct mapping from /cms/.. to actual physical file location. But this fails because IIS does not know anything about EPiServer virtual directory mapping and setup.
Quick workaround is to copy EPiServer.LanguageManager.config file to /cms/ directory in your website root.
/cms/ of course may varry depending on your EPiServer setup. /episerver/, /cms/ or any other configured directory.
We're using constructor dependency injection in our EPiServer site which has worked really well. Up to now, that is... We have started to install a few add-ons to the site and for some of them, e.g. SiteAttention, we're getting initialization problems. This is a frequent type of message:
In the case of SiteAttention we get this in the menu of the Admin mode (/webmgmt/CMS/Admin/Menu.aspx), the rest of the site works fine. We're having similar problems with EPiServer Languages, but as that error seems more complicated I think it might be easier to solve SiteAttention first...
Our dependency resolver looks like this:
Any ideas of what the problem might be is greatly appriecated! This is starting to get to me...
Cheers!
Emil