Structuremap production error.

999 views
Skip to first unread message

Magnus Bertilsson

unread,
May 30, 2011, 5:40:39 AM5/30/11
to structuremap-users
Hello

I we have used structuremap for a while in our application and in
production we get an error that we can't find the reason for.

The only way we see it is in the error log and can't recreate it our
self's but what I can read from the different exceptions there is that
it throws when we ask structuremap for an instance and this is can be
for any class we have.

Is there anyone how knows whats wrong or can give me a suggestion how
to get any more information about the error?

This is one of the Exceptions:
1: Error Description:Exception of type
'System.Web.HttpUnhandledException' was thrown.
---------------------------------------
1: Source:System.Web
---------------------------------------
1: Stack Trace: at System.Web.UI.Page.HandleError(Exception e)
1: at System.Web.UI.Page.ProcessRequestMain(Boolean
includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint)
1: at System.Web.UI.Page.ProcessRequest(Boolean
includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint)
1: at System.Web.UI.Page.ProcessRequest()
1: at System.Web.UI.Page.ProcessRequestWithNoAssert(HttpContext
context)
1: at System.Web.UI.Page.ProcessRequest(HttpContext context)
1: at
ASP.inside_graphs_competitionstepprofile_aspx.ProcessRequest(HttpContext
context)
1: at
System.Web.HttpApplication.CallHandlerExecutionStep.System.Web.HttpApplication.IExecutionStep.Execute()
1: at System.Web.HttpApplication.ExecuteStep(IExecutionStep step,
Boolean& completedSynchronously)
1: Target Site:Boolean HandleError(System.Exception)
2: Error Description:Activation error occured while trying to get
instance of type IAuthorizationContext`1, key ""
---------------------------------------
2: Source:Microsoft.Practices.ServiceLocation
---------------------------------------
2: Stack Trace: at
Microsoft.Practices.ServiceLocation.ServiceLocatorImplBase.GetInstance(Type
serviceType, String key)
2: at
Microsoft.Practices.ServiceLocation.ServiceLocatorImplBase.GetInstance[TService]
()
2: at App_Code.V3.Page.Auth.AuthPage`2.AuthPage_PreInit(Object
sender, EventArgs e)
2: at System.Web.UI.Page.OnPreInit(EventArgs e)
2: at System.Web.UI.Page.PerformPreInit()
2: at System.Web.UI.Page.ProcessRequestMain(Boolean
includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint)
2: Target Site:System.Object GetInstance(System.Type, System.String)
3: Error Description:StructureMap Exception Code: 207
Internal exception while creating Instance 'da1edbfe-eaff-4e35-91a7-
c15cd46f196f' of PluginType
App_Code.V3.Security.IAuthorizationContext`1[[Tappa.Model.User.Account,
Tappa, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null]],
tappa_deploy, Version=1.0.4164.23865, Culture=neutral,
PublicKeyToken=null. Check the inner exception for more details.
---------------------------------------
3: Source:StructureMap
---------------------------------------
3: Stack Trace: at StructureMap.Pipeline.LambdaInstance`1.build(Type
pluginType, BuildSession session)
3: at StructureMap.Pipeline.Instance.createRawObject(Type
pluginType, BuildSession session)
3: at StructureMap.Pipeline.Instance.Build(Type pluginType,
BuildSession session)
3: at StructureMap.Pipeline.ObjectBuilder.Resolve(Type pluginType,
Instance instance, BuildSession session)
3: at StructureMap.BuildSession.CreateInstance(Type pluginType,
Instance instance)
3: at StructureMap.BuildSession.<>c__DisplayClass3.<.ctor>b__1()
3: at StructureMap.BuildSession.CreateInstance(Type pluginType)
3: at StructureMap.Container.GetInstance(Type pluginType)
3: at
App_Code.BootStrapperV2.StructureMapServiceLocator.DoGetInstance(Type
serviceType, String key)
3: at
Microsoft.Practices.ServiceLocation.ServiceLocatorImplBase.GetInstance(Type
serviceType, String key)
3: Target Site:System.Object build(System.Type,
StructureMap.BuildSession)
4: Error Description:StructureMap Exception Code: 308
A configured instance interceptor has failed for Instance
'bc341269-42ac-474d-a91a-2e0c3c8fbf76' and concrete type
'Tappa.Infrastructure.NHibernate.Repository, Tappa.Infrastructure,
Version=1.0.0.0, Culture=neutral, PublicKeyToken=null'
---------------------------------------
4: Source:StructureMap
---------------------------------------
4: Stack Trace: at
StructureMap.Pipeline.ObjectBuilder.ApplyInterception(Type pluginType,
Object actualValue, BuildSession session, Instance instance)
4: at StructureMap.Pipeline.ObjectBuilder.Resolve(Type pluginType,
Instance instance, BuildSession session)
4: at StructureMap.BuildSession.CreateInstance(Type pluginType,
Instance instance)
4: at StructureMap.BuildSession.<>c__DisplayClass3.<.ctor>b__1()
4: at StructureMap.BuildSession.CreateInstance(Type pluginType)
4: at StructureMap.BuildSession.GetInstance[T]()
4: at
App_Code.BootStrapperV2.StructureMapBootstrapper.<ExecuteCore>b__2(IContext
ctx)
4: at StructureMap.Pipeline.LambdaInstance`1.build(Type pluginType,
BuildSession session)
4: Target Site:System.Object ApplyInterception(System.Type,
System.Object, StructureMap.BuildSession,
StructureMap.Pipeline.Instance)
5: Error Description:The given key was not present in the dictionary.
---------------------------------------
5: Source:mscorlib
---------------------------------------
5: Stack Trace: at
System.Collections.Generic.Dictionary`2.get_Item(TKey key)
5: at
StructureMap.Interceptors.InterceptorLibrary.FindInterceptor(Type
type)
5: at StructureMap.Pipeline.ObjectBuilder.ApplyInterception(Type
pluginType, Object actualValue, BuildSession session, Instance
instance)
5: Target Site:TValue get_Item(TKey)

Jeremy D. Miller

unread,
May 31, 2011, 10:03:24 AM5/31/11
to structure...@googlegroups.com
So what's it doing when it's trying to build App_Code.V3.Security.IAuthorizationContext`1[[Tappa.Model.User.Account,
Tappa, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null]], inside a Lambda function?


 
Jeremy D. Miller
The Shade Tree Developer
jeremy...@yahoo.com



From: Magnus Bertilsson <magnus.b...@gmail.com>
To: structuremap-users <structure...@googlegroups.com>
Sent: Mon, May 30, 2011 4:40:39 AM
Subject: [sm-users] Structuremap production error.
--
You received this message because you are subscribed to the Google Groups "structuremap-users" group.
To post to this group, send email to structure...@googlegroups.com.
To unsubscribe from this group, send email to structuremap-users+unsub...@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/structuremap-users?hl=en.

Magnus Bertilsson

unread,
May 31, 2011, 10:19:07 AM5/31/11
to structure...@googlegroups.com
The configuration looks like this:

x.For<IAuthorizationContext<Account>>().Use(
                    ctx => new Authorization<Account>(ctx.GetInstance<IRepository>(), HttpContext.Current.User.Identity));



To unsubscribe from this group, send email to structuremap-us...@googlegroups.com.

Jeremy D. Miller

unread,
May 31, 2011, 10:33:55 AM5/31/11
to structure...@googlegroups.com
Are you getting nailed because of this:  HttpContext.Current.User.Identity?
 

From: Magnus Bertilsson <magnus.b...@gmail.com>
To: structure...@googlegroups.com
Sent: Tue, May 31, 2011 9:19:07 AM
Subject: Re: [sm-users] Structuremap production error.

Magnus Bertilsson

unread,
May 31, 2011, 10:39:55 AM5/31/11
to structure...@googlegroups.com
Well this is't the only type that throw this exception when I ask for it. 

Like this stack trace under this I ask for IRepository with this configuration: 

x.For<ISessionFactory>().Singleton().Use(NHibernateConfigurator.Configuration().BuildSessionFactory());
x.For<ISession>().HttpContextScoped().Use(ctx => ctx.GetInstance<ISessionFactory>().GetCurrentSession());
x.For<IRepository>().Use<Repository>(); 

And I user Fluent-NHibernate to configure the SessionFactory.

1: Error Description:Exception of type 'System.Web.HttpUnhandledException' was thrown.
---------------------------------------
1: Source:System.Web
---------------------------------------
1: Stack Trace:   at System.Web.UI.Page.HandleError(Exception e)
1:    at System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint)
1:    at System.Web.UI.Page.ProcessRequest(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint)
1:    at System.Web.UI.Page.ProcessRequest()
1:    at System.Web.UI.Page.ProcessRequestWithNoAssert(HttpContext context)
1:    at System.Web.UI.Page.ProcessRequest(HttpContext context)
1:    at ASP.inside_community_manager_forum_aspx.ProcessRequest(HttpContext context)
1:    at System.Web.HttpApplication.CallHandlerExecutionStep.System.Web.HttpApplication.IExecutionStep.Execute()
1:    at System.Web.HttpApplication.ExecuteStep(IExecutionStep step, Boolean& completedSynchronously)
1: Target Site:Boolean HandleError(System.Exception)
2: Error Description:Activation error occured while trying to get instance of type IRepository, key ""
---------------------------------------
2: Source:Microsoft.Practices.ServiceLocation
---------------------------------------
2: Stack Trace:   at Microsoft.Practices.ServiceLocation.ServiceLocatorImplBase.GetInstance(Type serviceType, String key)
2:    at Microsoft.Practices.ServiceLocation.ServiceLocatorImplBase.GetInstance[TService]()
2:    at ClassLib.StaticUserFix.GetPersonalization(Int64 userId)
2:    at ClassLib.Community.ForumMessage.FillObject(IDataReader dataReader)
2:    at ClassLib.Community.ForumMessageDB.GetAllThreads(Int32 categoryID)
2:    at inside_community_content_usercontrols_ForumThreadsList.Bind_List(Int32 currentPage)
2:    at inside_community_content_usercontrols_ForumThreadsList.Page_Load(Object sender, EventArgs e)
2:    at System.Web.Util.CalliHelper.EventArgFunctionCaller(IntPtr fp, Object o, Object t, EventArgs e)
2:    at System.Web.Util.CalliEventHandlerDelegateProxy.Callback(Object sender, EventArgs e)
2:    at System.EventHandler.Invoke(Object sender, EventArgs e)
2:    at System.Web.UI.Control.OnLoad(EventArgs e)
2:    at App_Code.V3.Page.Base.BaseUserControl.OnLoad(EventArgs e)
2:    at System.Web.UI.Control.LoadRecursive()
2:    at System.Web.UI.Control.LoadRecursive()
2:    at System.Web.UI.Control.LoadRecursive()
2:    at System.Web.UI.Control.LoadRecursive()
2:    at System.Web.UI.Control.LoadRecursive()
2:    at System.Web.UI.Control.LoadRecursive()
2:    at System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint)
2: Target Site:System.Object GetInstance(System.Type, System.String)
3: Error Description:StructureMap Exception Code:  308
A configured instance interceptor has failed for Instance '0f986afe-0604-4e68-a3a0-1c69eb3456ce' and concrete type 'Tappa.Infrastructure.NHibernate.Repository, Tappa.Infrastructure, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null'
---------------------------------------
3: Source:StructureMap
---------------------------------------
3: Stack Trace:   at StructureMap.Pipeline.ObjectBuilder.ApplyInterception(Type pluginType, Object actualValue, BuildSession session, Instance instance)
3:    at StructureMap.Pipeline.ObjectBuilder.Resolve(Type pluginType, Instance instance, BuildSession session)
3:    at StructureMap.BuildSession.CreateInstance(Type pluginType, Instance instance)
3:    at StructureMap.BuildSession.<>c__DisplayClass3.<.ctor>b__1()
3:    at StructureMap.BuildSession.CreateInstance(Type pluginType)
3:    at StructureMap.Container.GetInstance(Type pluginType)
3:    at App_Code.BootStrapperV2.StructureMapServiceLocator.DoGetInstance(Type serviceType, String key)
3:    at Microsoft.Practices.ServiceLocation.ServiceLocatorImplBase.GetInstance(Type serviceType, String key)
3: Target Site:System.Object ApplyInterception(System.Type, System.Object, StructureMap.BuildSession, StructureMap.Pipeline.Instance)
4: Error Description:The given key was not present in the dictionary.
---------------------------------------
4: Source:mscorlib
---------------------------------------
4: Stack Trace:   at System.Collections.Generic.Dictionary`2.get_Item(TKey key)
4:    at StructureMap.Interceptors.InterceptorLibrary.FindInterceptor(Type type)
4:    at StructureMap.Pipeline.ObjectBuilder.ApplyInterception(Type pluginType, Object actualValue, BuildSession session, Instance instance)
4: Target Site:TValue get_Item(TKey)
Reply all
Reply to author
Forward
0 new messages