user1511520
user1511520

Reputation: 81

Structuremap 207 error after deploying on IIS

we are developing an application using ASP.Net MVC 3.0 framework. we are using structuremap for injecting the objects at runtime. for this purpose we are using constructor injection. we have written custom controller factory, where the creation of controllers are delegated to this factory through return (Controller)ObjectFactory.GetInstance(controllerType);. Defined definition using DSL by mapping interfaces with the concrete classes.

Everything is working fine when the application is running on visual studio development server. But when the same application is deployed on the IIS 7.0, it is throwing 207 error while creating the objects at runtime.

could anyone help whether we need to update any settings on IIS or help the steps to debug this issue? Please find the below stack trace for the issue

ExceptionStructureMap Exception Code:  
207 Internal exception while creating Instance '83248ea8-b195-4166-8a7d-678e9a677c9f' of PluginType Payrs.Web.Controllers.PaymentRequestController.  
Check the inner exception for more details.Stack Trace :   
 at StructureMap.Pipeline.ConstructorInstance.Build(Type pluginType, BuildSession session, IInstanceBuilder builder)  
    at StructureMap.Pipeline.ConstructorInstance.build(Type pluginType, BuildSession session)    
     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.<>c__DisplayClass3.<.ctor>b__1()    
           at StructureMap.BuildSession.CreateInstance(Type pluginType)    
            at Payrs.Web.Infrastructure.PayrsControllerFactory.GetControllerInstance(RequestContext requestContext, Type controllerType)  


             **Inner Exception**    

              at Payrs.Web.Controllers.PaymentRequestController..ctor(IPaymentService paymentRequestService, IFundingService fundingService)   
                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)

Upvotes: 3

Views: 7948

Answers (1)

user1511520
user1511520

Reputation: 81

I could able to figure out the issue after troubleshooting through the structuremap code and the web server monitoring.

In this case, there is an unhand-led exception occurring, which is collapsing the current app domain and creating new app domain to process the request. As the entire structuremap configuration is done at app domain level, the container definition is nullifying, which is the reason the structure map is not able to inject the objects in constructor.

Elmah helped me in identifying the unhand-led exception, which by correcting the issue and handling the exceptions avoided this error.

Upvotes: 5

Related Questions