Skip to content

StructureMap isn't creating WebAPI controllers for some reason. #6

@B3nCr

Description

@B3nCr

Hi

I'm struggling at the moment to work out what's going on with my app.

We've recently included an owin Startup class and I believe that's what's made StructureMap stop working.

It seems like WebAPI can't create any of my controllers and I can't see StructureMap anywhere in the stack trace so that's making me think it's not registered as the controller factory or something.

"ExceptionMessage": "Type 'GRP2App.Web.API.AuthController' does not have a default constructor",
"ExceptionType": "System.ArgumentException",
"StackTrace": "
  at System.Linq.Expressions.Expression.New(Type type)
  at System.Web.Http.Internal.TypeActivator.Create[TBase](Type instanceType)
  at System.Web.Http.Dispatcher.DefaultHttpControllerActivator.GetInstanceOrActivator(HttpRequestMessage request, Type controllerType, Func`1& activator)
  at System.Web.Http.Dispatcher.DefaultHttpControllerActivator.Create(HttpRequestMessage request, HttpControllerDescriptor controllerDescriptor, Type controllerType)"

What am I missing? There must be an OWIN config line that I'm missing that tells OWIN that StructureMap is my DI container and to use it to create controller instances

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions