Skip to content

Custom middleware will not initialize #44

@miguelcastro67

Description

@miguelcastro67

Hey everyone - can't seem to find a single thing on the web about this.
Everything setup correctly, controllers accept injection with no problem.
I have a middleware component with an additional constructor argument and when I add the app.builder.use to initialize it, I get an error about it only wanting a constructor with one argument. I tried property injection too with no joy. Basically, what is the exact procedure for ensuring middleware can accept injections?

Here's the Startup code - very simple. "container" is properly built and has everything registered into it.

        appBuilder.UseNinjectMiddleware(() => container);
        appBuilder.Use<LoggerMiddleware>(); // my custom middleware
        appBuilder.UseNinjectWebApi(config);

Anyone have any ideas?

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