ninject / Ninject

the ninja of .net dependency injectors
http://ninject.org/
Other
2.67k stars 531 forks source link

Authorize attribute calls two times #385

Open artkh24 opened 2 years ago

artkh24 commented 2 years ago

I'm using ninject version 3.3.4

        var kernel = new StandardKernel();
        try
        {
            kernel.Bind<Func<IKernel>>().ToMethod(ctx => () => new Bootstrapper().Kernel);
            kernel.Bind<IHttpModule>().To<HttpApplicationInitializationHttpModule>();

            RegisterServices(kernel);

            System.Web.Http.GlobalConfiguration.Configuration.DependencyResolver = new NinjectDependencyResolver(kernel);

            return kernel;
        }
        catch
        {
            kernel.Dispose();
            throw;
        }

ninject creates binding for IFilterProvider which makes Authorize attribute two call two times per web api request are there any options in StandardKernel to avoid this binding

scott-xu commented 1 year ago

Can you please create a minimal web api application that replicate the issue and send it to me?