November Happy Hour will be moved to Thursday December 5th.

Problem while deploying on Server

Vote:
 

Dear all,

On my developpment machine everything works fine but as soon as I deploy it on the server I get the error displayed below.

Any idea what it could be?

Best regards,

Daniel

-----

Server Error in '/Main' Application.


StructureMap Exception Code:  202
No Default Instance defined for PluginFamily EPiServer.Core.Transfer.IContentCopyHandler, EPiServer, Version=7.0.586.1, Culture=neutral, PublicKeyToken=8fe83dea738b45b7

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: StructureMap.StructureMapException: StructureMap Exception Code:  202
No Default Instance defined for PluginFamily EPiServer.Core.Transfer.IContentCopyHandler, EPiServer, Version=7.0.586.1, Culture=neutral, PublicKeyToken=8fe83dea738b45b7

Source Error: 

 

[No relevant source lines]


Source File: c:\Windows\Microsoft.NET\Framework64\v4.0.30319\Temporary ASP.NET Files\main\6d2c61ab\d6e63713\App_global.asax.0.cs    Line: 

Stack Trace: 

 

[StructureMapException: StructureMap Exception Code:  202

No Default Instance defined for PluginFamily EPiServer.Core.Transfer.IContentCopyHandler, EPiServer, Version=7.0.586.1, Culture=neutral, PublicKeyToken=8fe83dea738b45b7]

   StructureMap.BuildSession.<.ctor>b__0(Type t) +217

   StructureMap.Util.Cache`2.get_Item(KEY key) +199

   StructureMap.BuildSession.CreateInstance(Type pluginType) +16

   StructureMap.Pipeline.Instance.createRawObject(Type pluginType, BuildSession session) +87

   StructureMap.Pipeline.Instance.Build(Type pluginType, BuildSession session) +50

   StructureMap.Pipeline.ConstructorInstance.Get(String propertyName, BuildSession session) +93

   lambda_method(Closure , IArguments ) +549

   StructureMap.Construction.<>c__DisplayClass2.<CreateBuilder>b__0(IArguments args) +27

   StructureMap.Construction.InstanceBuilder.BuildInstance(IArguments args) +15

   StructureMap.Pipeline.ConstructorInstance.Build(Type pluginType, BuildSession session, IInstanceBuilder builder) +303

   StructureMap.Pipeline.Instance.createRawObject(Type pluginType, BuildSession session) +87

   StructureMap.Pipeline.Instance.Build(Type pluginType, BuildSession session) +50

   StructureMap.Pipeline.ObjectBuilder.Resolve(Type pluginType, Instance instance, BuildSession session) +147

   StructureMap.BuildSession.CreateInstance(Type pluginType, Instance instance) +72

   StructureMap.BuildSession.CreateInstance(Type pluginType) +23

   EPiServer.ServiceLocation.ServiceLocatorImplBase.GetInstance(Type serviceType, String key) +70

 

[ActivationException: Activation error occurred while trying to get instance of type DefaultContentProvider, key ""]

   EPiServer.ServiceLocation.ServiceLocatorImplBase.GetInstance(Type serviceType, String key) +181

   EPiServer.ServiceLocation.ServiceLocatorImplBase.GetInstance() +59

   EPiServer.Core.ContentProviderMap.LoadProviders(ProviderSettingsCollection pageProvidersCollection) +355

   EPiServer.Initialization.<>c__DisplayClass5.<Initialize>b__0() +108

   System.Threading.Tasks.Task.Execute() +130

 

[AggregateException: One or more errors occurred.]

   System.Threading.Tasks.Task.WaitAll(Task[] tasks, Int32 millisecondsTimeout, CancellationToken cancellationToken) +1738

   System.Threading.Tasks.Task.WaitAll(Task[] tasks, Int32 millisecondsTimeout) +84

   System.Threading.Tasks.Task.WaitAll(Task[] tasks) +39

   EPiServer.Initialization.CmsCoreInitialization.Initialize(InitializationEngine context) +1065

   EPiServer.Framework.Initialization.ModuleNode.Execute(Action a, String key) +64

   EPiServer.Framework.Initialization.InitializationEngine.InitializeModules() +751

   EPiServer.Framework.Initialization.InitializationEngine.Initialize(HostType hostType) +168

   EPiServer.Framework.Initialization.InitializationModule.Initialize(HostType hostType) +308

   EPiServer.Framework.Initialization.InitializationModule.FrameworkInitialization(HostType hostType) +75

   EPiServer.Global..ctor() +103

   Namespace.EpiServerTms.Global..ctor() +40

   ASP.global_asax..ctor() in c:\Windows\Microsoft.NET\Framework64\v4.0.30319\Temporary ASP.NET Files\main\6d2c61ab\d6e63713\App_global.asax.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) +117

   System.RuntimeType.CreateInstanceDefaultCtor(Boolean publicOnly, Boolean skipVisibilityChecks, Boolean skipCheckThis, Boolean fillCache) +247

   System.Activator.CreateInstance(Type type, Boolean nonPublic) +106

   System.RuntimeType.CreateInstanceImpl(BindingFlags bindingAttr, Binder binder, Object[] args, CultureInfo culture, Object[] activationAttributes) +12733325

   System.Activator.CreateInstance(Type type, BindingFlags bindingAttr, Binder binder, Object[] args, CultureInfo culture) +28

   System.Web.HttpRuntime.CreateNonPublicInstance(Type type, Object[] args) +83

   System.Web.HttpApplicationFactory.GetSpecialApplicationInstance(IntPtr appContext, HttpContext context) +315

   System.Web.Hosting.PipelineRuntime.InitializeApplication(IntPtr appContext) +375

 

[HttpException (0x80004005): Exception has been thrown by the target of an invocation.]

   System.Web.HttpRuntime.FirstRequestInit(HttpContext context) +11686928

   System.Web.HttpRuntime.EnsureFirstRequestInit(HttpContext context) +141

   System.Web.HttpRuntime.ProcessRequestNotificationPrivate(IIS7WorkerRequest wr, HttpContext context) +4863749

 

#66229
Feb 25, 2013 12:24
Vote:
 

Try deleting the temporary asp.net files and/or IIS reset and if that doesn't help, see the differences in web.config file for localhost and test server. Check if you have StructureMap in runtime/assemblyBinding/dependentAssembly. If so, delete it. Hope it helps.

 

#66232
Feb 25, 2013 13:10
Vote:
 

Hi Marija!

Thank you for your answer!
I have done what you suggested but I have still the same error.

Any other idea what it could be?

Best regards,

Daniel

---- log4net output ----

---> (Inner Exception #0) EPiServer.ServiceLocation.ActivationException: Activation error occurred while trying to get instance of type DefaultContentProvider, key "" ---> StructureMap.StructureMapException: StructureMap Exception Code: 202
No Default Instance defined for PluginFamily EPiServer.Core.Transfer.IContentCopyHandler, EPiServer, Version=7.0.586.1, Culture=neutral, PublicKeyToken=8fe83dea738b45b7
at StructureMap.BuildSession.<.ctor>b__0(Type t)
at StructureMap.Util.Cache`2.get_Item(KEY key)
at StructureMap.BuildSession.CreateInstance(Type pluginType)
at StructureMap.Pipeline.Instance.createRawObject(Type pluginType, BuildSession session)
at StructureMap.Pipeline.Instance.Build(Type pluginType, BuildSession session)
at StructureMap.Pipeline.ConstructorInstance.Get[T](String propertyName, BuildSession session)
at lambda_method(Closure , IArguments )
at StructureMap.Construction.BuilderCompiler.FuncCompiler`1.<>c__DisplayClass2.<CreateBuilder>b__0(IArguments args)
at StructureMap.Construction.InstanceBuilder.BuildInstance(IArguments args)
at StructureMap.Pipeline.ConstructorInstance.Build(Type pluginType, BuildSession session, IInstanceBuilder builder)
at StructureMap.Pipeline.Instance.createRawObject(Type pluginType, BuildSession session)
at StructureMap.Pipeline.Instance.Build(Type pluginType, BuildSession session)
at StructureMap.Pipeline.ObjectBuilder.Resolve(Type pluginType, Instance instance, BuildSession session)
at StructureMap.BuildSession.CreateInstance(Type pluginType, Instance instance)
at StructureMap.BuildSession.CreateInstance(Type pluginType)
at EPiServer.ServiceLocation.ServiceLocatorImplBase.GetInstance(Type serviceType, String key)
--- End of inner exception stack trace ---
at EPiServer.ServiceLocation.ServiceLocatorImplBase.GetInstance(Type serviceType, String key)
at EPiServer.ServiceLocation.ServiceLocatorImplBase.GetInstance[TService]()
at EPiServer.Core.ContentProviderMap.LoadProviders(ProviderSettingsCollection pageProvidersCollection)
at EPiServer.Initialization.CmsCoreInitialization.<>c__DisplayClass5.<Initialize>b__0()
at System.Threading.Tasks.Task.Execute()<---

#66244
Edited, Feb 25, 2013 16:15
Vote:
 

I am having this problem sometimes while rebuilding the application often.


Things that cross my mind are:

- Do you have a valid license?

- Can you reinstall EPiServer?

Maybe this is a bit heavy, but I don't have a smarter answer.

#66247
Feb 25, 2013 16:48
Vote:
 

Make sure you're registering your StructureMap DependencyResolver in an IInitializableModule so it starts up at the right time (and not just in Global.asax or similar).

Hope this helps.

Frederik

#66263
Feb 26, 2013 8:03
Vote:
 

Hi, Daniel & Frederik,

Can you please post the IInitializableModule that has solved this issue? I have the same problem on the production server now, but it seems that I am doing something wrong.

Thank you in advance!

Marija

 

#68305
Edited, Mar 19, 2013 16:31
Vote:
 

Just move the code from Global.asax to an IInitializableModule:

[ModuleDependency(typeof(ServiceContainerInitialization))]
    [InitializableModule]
    public class DependencyResolverInitialization : IConfigurableModule
    {
        public void ConfigureContainer(ServiceConfigurationContext context)
        {
            context.Container.Configure(ConfigureContainer);

            // This will setup the DependencyResolver with the EPiServer StructureMap Container
            DependencyResolver.SetResolver(new StructureMapDependencyResolver(context.Container));
        }

        private static void ConfigureContainer(ConfigurationExpression container)
        {
            container.AddRegistry<StructureMapRegistry>();
        }

        public void Initialize(InitializationEngine context)
        {
        }

        public void Uninitialize(InitializationEngine context)
        {
        }

        public void Preload(string[] parameters)
        {
        }
    }

Frederik

#68306
Mar 19, 2013 16:33
Vote:
 

This fixed our problem, thx, Frederik, for the quick and accurate answer! :)

#68366
Mar 20, 2013 17:51
Vote:
 

I've got the same problem at the moment. It works on some developer machines and not others.

I have tried everything on this thread but it is still coming out with this error. The code and config are the same so it must be something environmental on these machines. The versions of EPiServer are the same as well.

I am at a complete loss. This is a nasty issue. Has anyone else got any other ideas.

Thanks

 

#79821
Jan 08, 2014 10:58
Vote:
 

Hi, Tim,

Where and when do you configure your IoC container? Can you post some code? It should be (if it's the same error as explained above) that you are calling some code prior to initialization of structuremap.

For me, this post was of great help http://www.epinova.no/blog/tarjei-olsen/dates/2013/1/injecting-stuff-in-your-view-controller/. I have rewritten my initialization as explained there. Then, you would use ServiceLocator.Current.GetInstance<IProvideAwesomeness> everywhere in the code (instead of using StructureMap classes directly).

It should be that if you clear temporary files and kill IISExpress, you will be able to reproduce the bug on your machine as well.

#79822
Jan 08, 2014 11:12
Vote:
 

Hi Marija

Thanks for your help

Previously I haven't explicitly configured the IoC container. I'm assuming episerver runs it under the covers (in global maybe).

I have also tried using Fredriks code above as an Initialisation Module but the line 

container.AddRegistry<StructureMapRegistry>();

Doesn't compile so I knocked it out. I'm not sure where the reference is for this.

Basically though we are not using IoC containers explicitly - the only place they are used is what EPiServer does. Everything seems the same - iot's as if the IoC initialisation in EPiServer.Global doesn't run correctly in some circumstances.

I honestly think this is a bug in EPiServer. Certainly it shouldn't be this hard to set things up

 

#79833
Jan 08, 2014 12:09
Vote:
 

OK to clarify - the StructureMapRegistry looks where the custom initialsation goes. But since we aren't doing any custom initialisation then it makes sense I have nothing to put here

#79834
Jan 08, 2014 12:12
Vote:
 

Yes, sure, you don't need any of it since you don't have any custom initialization. Could it be that you are having an initializationmodule that is missing a dependency to [ModuleDependency(typeof(EPiServer.Web.InitializationModule))]?

I assume stack trace doesn't give you any entry point in your code, but seems like an EPiServer bug? What version are you running?

 

#79843
Jan 08, 2014 12:32
Vote:
 

The error is at a piece of code that does

LanguageBranch.LanguageBranchRepository.Load(cultureInfo);

And the stack trace is 

[StructureMapException: StructureMap Exception Code:  202

No Default Instance defined for PluginFamily EPiServer.DataAbstraction.ILanguageBranchRepository, EPiServer, Version=7.0.586.8, Culture=neutral, PublicKeyToken=8fe83dea738b45b7]

   StructureMap.BuildSession.<.ctor>b__0(Type t) +162

   StructureMap.Util.Cache`2.get_Item(KEY key) +160

   StructureMap.BuildSession.CreateInstance(Type pluginType) +14

   StructureMap.Container.GetInstance(Type pluginType) +79

   EPiServer.ServiceLocation.StructureMapServiceLocator.DoGetInstance(Type serviceType, String key) +43

   EPiServer.ServiceLocation.ServiceLocatorImplBase.GetInstance(Type serviceType, String key) +50

 

[ActivationException: Activation error occurred while trying to get instance of type ILanguageBranchRepository, key ""]

   EPiServer.ServiceLocation.ServiceLocatorImplBase.GetInstance(Type serviceType, String key) +110

   EPiServer.ServiceLocation.ServiceLocatorImplBase.GetInstance() +65

   EPiServer.DataAbstraction.LanguageBranch.get_LanguageBranchRepository() +31

 

#79849
Edited, Jan 08, 2014 13:25
Vote:
 

Oh and I am CMS 7.

Generally I could understand the failure but it's the fact it works on some but not others that is puzzling (very very puzzling)

#79850
Jan 08, 2014 13:27
Vote:
 

I can't reproduce the error, but can you try rewriting it like this:

var langRepo = ServiceLocator.Current.GetInstance<ILanguageBranchRepository>();
var yy = langRepo.Load(cultureInfo);

  

I meant which specific version of 7, have you upgraded to 7.0.586.24? Maybe there was some sort of bug in the earlier versions.

#79851
Jan 08, 2014 13:39
Vote:
 

Brilliant. Thank you so much that work!!! It must be a bug in the build. We are on 7.0.586.8

Thank you

#79861
Jan 08, 2014 17:29
Vote:
 

Had the same problem:

[ActivationException: Activation error occurred while trying to get instance of type DefaultContentProvider, key ""]

with inner exception:

System.EntryPointNotFoundException

 

this fixed problem for me:

<runtime>
<assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1">
<dependentAssembly>
<assemblyIdentity name="StructureMap" publicKeyToken="e60ad81abae3c223" culture="neutral" />
<bindingRedirect oldVersion="0.0.0.0-2.6.4.0" newVersion="2.6.4.0" />
</dependentAssembly>
</assemblyBinding>
</runtime>

#80449
Edited, Jan 23, 2014 8:45
Vote:
 

Installing two Nugets solved it for me.

EPiServer.CMS.Core -Version 7.0.586.1

EPiServer.Framework -Version 7.0.859.1
#81891
Feb 28, 2014 9:09
Vote:
 

Hello,

(I'm running 7.19 so a bug fixed in this version is not the case - read on)

I have found a definite (?) solution to this problem.

To troubleshoot and gain more insight, (a bit simplistically to skip some precursory details) open the following locations on both your machines:

  • C:\Users\(your account)\AppData (this folder is hidden)\Temporary ASP.NET Files\
  • C:\Users\(your application pool account)\AppData (this folder is hidden)\Temporary ASP.NET Files\
  • C:\Windows\Microsoft.NET\Framework\v4.0 (or whatever version you're running)\Temporary ASP.NET Files\
  • C:\Windows\Microsoft.NET\Framework64\v4.0 (or whatever version you're running)\Temporary ASP.NET Files\

(Probably, the 2 last ones won't be needed but are left for the cargo-cult troubleshooter)

Delete all folders inside (you may need to stop IIS/IIS express for a while) and only start the EPiServer websites you need to troubleshoot.

If you're running Cassini, you'll probably see a vs\ folder inside location 1, inside that you'll find a folder with a HEX-based name and another one inside that, inside that you'll find a folder UserCache\. Inside this folder you have a EPiFxAssemblyTypeCache.xml where all types that are used for IoC are listed. This is a performance thing because Reflection is very slow (read here), but it also allows us to troubleshoot without the need for fiddling with log4net.

If you're running IIS proper, you'll probably see a vs\ folder inside location 2, inside that you'll find a folder with a HEX-based name, and eventually you'll find the same EPiFxAssemblyTypeCache.xml in there.

Comparing these with diff is no use at once, since the assemblies inside are not ordered. But you'll probably find that EPiServer.Enterprise is missing from the faulty installation.

Now, seeing that EPiServer.Enterprise contains the default implementation for IContentCopyHandler, ([ServiceConfiguration(ServiceType = typeof (IContentCopyHandler))] public class ContentCopyHandler : IContentCopyHandler), you will notice that removing EPiServer.Enterprise.dll from your bin\ folder in the functioning site yields the same result (or: error message).

In my case, sending this file over FTP made the 200+kb file become ~23kb, so it probably became corrupted. Nevertheless, sending it again fixed the problem.

TL;DR Copy the bin folder again.

Björn Ali

#118449
Edited, Mar 06, 2015 11:46
Vote:
 

Hello, 

I am having same issue but not on the website. My webiste is working just fine after 8.x upgrade. But Quartz is failing for me with this error. I have a separate post that shows the code and the exception. Any help will be much appreciated.

The other post is at:

http://world.episerver.com/forum/developer-forum/EPiServer-Commerce/Thread-Container/2015/6/quartz-initialization-issues-after-episerver-82.x-upgrade/

#123104
Jun 24, 2015 22:49
This thread is locked and should be used for reference only. Please use the Episerver CMS 7 and earlier versions forum to open new discussions.
* You are NOT allowed to include any hyperlinks in the post because your account hasn't associated to your company. User profile should be updated.