Skip to content

Multiple binding of HttpContextBase when used with Ninject.Web.Mvc #9

@SlyNet

Description

@SlyNet

Both Ninject.Web.WebApi and Ninject.Web.Mvc register:

this.Kernel.Bind<HttpContext>().ToMethod(ctx => HttpContext.Current).InTransientScope();
this.Kernel.Bind<HttpContextBase>().ToMethod(ctx => new HttpContextWrapper(HttpContext.Current)).InTransientScope();

And when you try to resolve HttpContextBase Ninject thows System.InvalidOperationException with message Error activating HttpContextBase\r\nMore than one matching bindings are available.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions