TargetInvocationException/ Exception has been thrown by the target of an invocation.

Topics: Web Client Software Factory, Project Management Forum, UIP Application Block discussion, User Forum
Jul 24, 2008 at 4:11 PM
Greetings all,
We were using the WebSF for our current application and lately we were seeing so many of the following errors. We didnt noticed while in the development machine but in production we are getting so many. I am kind of lost on where to start and how to tackle this issue. Any help is highly appreciated.

Here goes the error message.

Event Type: Warning
Event Source:   ASP.NET 2.0.50727.0
Event Category: Web Event
Event ID:   1309
Date:       7/24/2008
Time:       10:59:00 AM
User:       N/A
Computer:   NASPDSVWB09
Description:
Event code: 3005
Event message: An unhandled exception has occurred.
Event time: 7/24/2008 10:59:00 AM
Event time (UTC): 7/24/2008 3:59:00 PM
Event ID: 7e19fda16b874fc0bd7379b022c6c781
Event sequence: 16
Event occurrence: 5
Event detail code: 0
 
Application information:
    Application domain: /LM/W3SVC/2021595106/Root-1-128613839813627384
    Trust level: Full
    Application Virtual Path: /
    Application Path: C:\Inetpub\WebFEP\Production\WebUI\
    Machine name: NASPDSVWB09
 
Process information:
    Process ID: 3008
    Process name: w3wp.exe
    Account name: NT AUTHORITY\NETWORK SERVICE
 
Exception information:
    Exception type: TargetInvocationException
    Exception message: Exception has been thrown by the target of an invocation.
 
Request information:
    Request URL: http://Ourdomain/Ourapp/Views/Common/Pages/Insured.aspx
    Request path: /Quote/Views/Common/Pages/Insured.aspx
    User host address: 10.107.2.7
    User: 
    Is authenticated: False
    Authentication Type: 
    Thread account name: NT AUTHORITY\NETWORK SERVICE
 
Thread information:
    Thread ID: 19
    Thread account name: NT AUTHORITY\NETWORK SERVICE
    Is impersonating: False
    Stack trace:    at System.RuntimeMethodHandle._InvokeMethodFast(Object target, Object[] arguments, SignatureStruct& sig, MethodAttributes methodAttributes, RuntimeTypeHandle typeOwner)
   at System.RuntimeMethodHandle.InvokeMethodFast(Object target, Object[] arguments, Signature sig, MethodAttributes methodAttributes, RuntimeTypeHandle typeOwner)
   at System.Reflection.RuntimeConstructorInfo.Invoke(Object obj, BindingFlags invokeAttr, Binder binder, Object[] parameters, CultureInfo culture)
   at Microsoft.Practices.ObjectBuilder.CreationStrategy.InitializeObject(IBuilderContext context, Object existing, String id, ICreationPolicy policy)
   at Microsoft.Practices.ObjectBuilder.CreationStrategy.BuildUpNewObject(IBuilderContext context, Type typeToBuild, Object existing, String idToBuild)
   at Microsoft.Practices.ObjectBuilder.CreationStrategy.BuildUp(IBuilderContext context, Type typeToBuild, Object existing, String idToBuild)
   at Microsoft.Practices.ObjectBuilder.BuilderStrategy.BuildUp(IBuilderContext context, Type typeToBuild, Object existing, String idToBuild)
   at Microsoft.Practices.ObjectBuilder.ReflectionStrategy`1.BuildUp(IBuilderContext context, Type typeToBuild, Object existing, String idToBuild)
   at Microsoft.Practices.ObjectBuilder.BuilderStrategy.BuildUp(IBuilderContext context, Type typeToBuild, Object existing, String idToBuild)
   at Microsoft.Practices.ObjectBuilder.ReflectionStrategy`1.BuildUp(IBuilderContext context, Type typeToBuild, Object existing, String idToBuild)
   at Microsoft.Practices.ObjectBuilder.BuilderStrategy.BuildUp(IBuilderContext context, Type typeToBuild, Object existing, String idToBuild)
   at Microsoft.Practices.ObjectBuilder.ReflectionStrategy`1.BuildUp(IBuilderContext context, Type typeToBuild, Object existing, String idToBuild)
   at Microsoft.Practices.ObjectBuilder.BuilderStrategy.BuildUp(IBuilderContext context, Type typeToBuild, Object existing, String idToBuild)
   at Microsoft.Practices.ObjectBuilder.TypeMappingStrategy.BuildUp(IBuilderContext context, Type t, Object existing, String id)
   at Microsoft.Practices.ObjectBuilder.BuilderStrategy.BuildUp(IBuilderContext context, Type typeToBuild, Object existing, String idToBuild)
   at Microsoft.Practices.CompositeWeb.BuilderStrategies.ContainerAwareTypeMappingStrategy.BuildUp(IBuilderContext context, Type typeToBuild, Object existing, String idToBuild)
   at Microsoft.Practices.ObjectBuilder.CreationParameter.GetValue(IBuilderContext context)
   at Microsoft.Practices.ObjectBuilder.PropertySetterInfo.GetValue(IBuilderContext context, Type type, String id, PropertyInfo propInfo)
   at Microsoft.Practices.ObjectBuilder.PropertySetterStrategy.InjectProperties(IBuilderContext context, Object obj, String id)
   at Microsoft.Practices.ObjectBuilder.PropertySetterStrategy.BuildUp(IBuilderContext context, Type typeToBuild, Object existing, String idToBuild)
   at Microsoft.Practices.ObjectBuilder.CreationStrategy.BuildUp(IBuilderContext context, Type typeToBuild, Object existing, String idToBuild)
   at Microsoft.Practices.ObjectBuilder.BuilderStrategy.BuildUp(IBuilderContext context, Type typeToBuild, Object existing, String idToBuild)
   at Microsoft.Practices.ObjectBuilder.ReflectionStrategy`1.BuildUp(IBuilderContext context, Type typeToBuild, Object existing, String idToBuild)
   at Microsoft.Practices.ObjectBuilder.BuilderStrategy.BuildUp(IBuilderContext context, Type typeToBuild, Object existing, String idToBuild)
   at Microsoft.Practices.ObjectBuilder.ReflectionStrategy`1.BuildUp(IBuilderContext context, Type typeToBuild, Object existing, String idToBuild)
   at Microsoft.Practices.ObjectBuilder.BuilderStrategy.BuildUp(IBuilderContext context, Type typeToBuild, Object existing, String idToBuild)
   at Microsoft.Practices.ObjectBuilder.ReflectionStrategy`1.BuildUp(IBuilderContext context, Type typeToBuild, Object existing, String idToBuild)
   at Microsoft.Practices.ObjectBuilder.BuilderStrategy.BuildUp(IBuilderContext context, Type typeToBuild, Object existing, String idToBuild)
   at Microsoft.Practices.ObjectBuilder.TypeMappingStrategy.BuildUp(IBuilderContext context, Type t, Object existing, String id)
   at Microsoft.Practices.ObjectBuilder.BuilderStrategy.BuildUp(IBuilderContext context, Type typeToBuild, Object existing, String idToBuild)
   at Microsoft.Practices.CompositeWeb.BuilderStrategies.ContainerAwareTypeMappingStrategy.BuildUp(IBuilderContext context, Type typeToBuild, Object existing, String idToBuild)
   at Microsoft.Practices.CompositeWeb.ObjectBuilder.WCSFBuilderBase`1.DoBuildUp(IReadWriteLocator locator, Type typeToBuild, String idToBuild, Object existing, PolicyList[] transientPolicies)
   at Microsoft.Practices.CompositeWeb.ObjectBuilder.WCSFBuilderBase`1.BuildUp(IReadWriteLocator locator, Type typeToBuild, String idToBuild, Object existing, PolicyList[] transientPolicies)
   at Microsoft.Practices.CompositeWeb.CompositionContainer.BuildItem(IBuilder`1 builder, IReadWriteLocator locator, Object item)
   at Microsoft.Practices.CompositeWeb.WebClientApplication.BuildItemWithCurrentContext(Object obj)
   at Microsoft.Practices.CompositeWeb.Web.UI.Page.OnPreInit(EventArgs e)
   at System.Web.UI.Page.PerformPreInit()
   at System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint)
 
 
Custom event details:

For more information, see Help and Support Center at http://go.microsoft.com/fwlink/events.asp.


Coordinator
Jul 24, 2008 at 5:24 PM
I've asked Chris to take a look at your challenge.  He will probably be quicker with an insight that I will be on this.
Michael Puleio -- patterns & practices
http://blogs.msdn.com/mpuleio  
Jul 24, 2008 at 5:29 PM

Looking at the stack trace, it's blowing up while trying to call a constructor. The trace doesn't actually include the constructor in question, so I'm guessing there's something wrong with the method info that's being invoked. Do you have a class somewhere that has only a private/protected constructor that's being built up?

Typical causes of this sort of thing is missing type mappings. Has something changed in your configuration from dev to production?

Unfortunately without more detail on the objects you're trying to build, it's hard to give specific pointers. At this stage, the first thing to do is get it to happen in your test or dev environment. Then divide and conquer - remove most of the injected objects, then add them back in one by one until you find the one that fails.

Coordinator
Jul 24, 2008 at 11:10 PM
I have one additional question:  What is the server environment?  OS? IIS version? etc. If it is IIS7, are you running in IIS6 compatability mode?

Thanks,
Michael Puleio -- patterns & practices
http://blogs.msdn.com/mpuleio  
Jul 25, 2008 at 1:16 AM
Thanks to all who jumped to help me in this issue.

I will start in the direction to see whether there is any constructor that is private or protected.

To answer MichaelPuleio's question.

Windows OS 2003 RC2 64 bit. I tried in a 32 bit Env as well. Same error happends there too.
IIS 7.0.
.Net framwork - 3.5 installed

Application is configured to have its own application pool as well in IIS 7.0.

Thanks
SKR
Coordinator
Jul 25, 2008 at 4:38 AM
IIRC, there are challenges getting WCSF to work under straight IIS7.  I think you need to run in IIS6 compatability mode.