Questions tagged [ninject.web.mvc]

extension for ninject providing integration with ASP.NET MVC

Use this tag on questions that describe issues with this specific extension of the framework.

Main features that your question is about:

  • The integration between the Ninject core and ASP.NET MVC
  • Your extended HttpApplication (in Global.asax.cs) with NinjectHttpApplication
  • The activation of your controllers
  • Exposed dependencies and injections of types in
    • constructors
    • properties
    • methods

Github ninject.web.mvc extension

298 questions
32
votes
10 answers

NinjectDependencyResolver fails binding ModelValidatorProvider

I'm developing an ASP.NET Web Api 2.2 with C#, .NET Framework 4.5.1. After updating my Web.Api to Ninject 3.2.0 I get this error: Error activating ModelValidatorProvider using binding from ModelValidatorProvider to…
VansFannel
  • 45,055
  • 107
  • 359
  • 626
20
votes
4 answers

How to resolve error :the type does not appear to implement microsoft.practices.servicelocation.iservicelocator?

I am new to MVC, i am following "PRO ASP.NET MVC 4 by Adam Freeman". I am currently working on its 6th chapter. In which i am learning how to use Ninject in MVC 4 for Dependency Injection. I have created the application as described in the book. Now…
Ram Singh
  • 6,664
  • 35
  • 100
  • 166
13
votes
4 answers

Inject dependency into DelegatingHandler

I am new to dependency injection, but happy with Ninject and Ninject.Extensions.Logging to [Inject] my ILogger wherever i need it. However some DelegatingHandlers are spoiling all the fun. public class HttpsHandler : DelegatingHandler { …
Jos Vinke
  • 2,704
  • 3
  • 26
  • 45
11
votes
2 answers

RavenDB with Ninject in ASP.NET MVC3

I want to use RavenDB with ninject in my asp.net mvc3 project, Any idea how I have to configure this? kernel.Bind() .To() .InSingletonScope() …
Jedi Master Spooky
  • 5,629
  • 13
  • 57
  • 86
11
votes
3 answers

How does Ninject create controller in ASP.NET MVC?

This may be stupid question, but I am looking at Ninject sources and don't see NInject registering its own controller factory. I also don't see any IControllerFactory class in Ninject.Web.Mvc assembly. Am I missing something? How does Ninject create…
LukLed
  • 31,452
  • 17
  • 82
  • 107
10
votes
1 answer

Unit Testing with Ninject in MVC 4

I have a solution called MvcContacts with an MVC 4 project named MvcContacts and a unit testing project named MvcContacts.Test (created automatically when I checked the "enable unit testing" box in Visual Studio. I installed the Ninject.MVC NuGet…
user1477388
  • 20,790
  • 32
  • 144
  • 264
10
votes
2 answers

No matching bindings are available, and the type is not self-bindable in Ninject

I am using Ninjec, Ninject.Web.MVC and Ninject.Web.Common When I start my mvc application I get this binding error: What do I wrong in my binding? Error activating DbConnection No matching bindings are available, and the type is not…
Elisabeth
  • 20,496
  • 52
  • 200
  • 321
9
votes
2 answers

How is HttpContextBase being registered with ninject? I didn't explicitly bind it

I created a binding for HttpContextBase in my NinjectWebCommon.RegisterServices method, but when I try to reference it in my controllers or services I get an error message. Here's the binding: kernel.Bind().ToMethod(context => new…
BlakeH
  • 3,354
  • 2
  • 21
  • 31
9
votes
1 answer

Randomly-Occurring Ninject Exception: "Error loading Ninject component ICache"

I recently added both Ninject and Ninject.Web.Mvc to an existing ASP.NET MVC 4 web application. When browsing the site, I receive the following exception, seemingly at random: [InvalidOperationException: Error loading Ninject component ICache No …
UnhipGlint
  • 339
  • 3
  • 10
8
votes
4 answers

Ninject.MVC3. Bootstrapper.Initialize throws "Sequence contains no elements"

this question is not new, but my problem seems to have a different root than those I have seen so far. I have a solution containing several projects: two of them are C# MVC4. I installed Ninject.MVC3 Nuget package on both and I am using the…
peflorencio
  • 2,284
  • 2
  • 32
  • 40
8
votes
1 answer

What is the proper way of using Ninject convention based binding?

I use Ninject mainly as manual binding like bellow. Which is working properly kernel.Bind().ToSelf().InRequestScope(); kernel.Bind().To(); But when I try bind using Convention based binding, bit…
8
votes
1 answer

Do I need to register Ninject.OnePerRequestModule with Ninject.Web.MVC 3.0?

I'm using Ninject for DI and the Ninject.MVC3 extension within an MVC4 app, specifically version 3.0.0.6. Reading the documentation on Ninject's wiki, it appears that the lifetime of objects created with InRequestScope are actually controlled by…
Paul M Sorauer
  • 667
  • 8
  • 10
7
votes
3 answers

Ninject Dependency Injection with Asp.Net MVC3 or MVC4

I am using Ninject MVC3(version 3.0.0.0) for my ASP.Net MVC3 application installed using NuGet Package for Dependency Injection. Here is the Global.asax change: public class MvcApplication : NinjectHttpApplication { public static void…
Prasad
  • 58,881
  • 64
  • 151
  • 199
7
votes
2 answers

How to stop Ninject from overriding custom DataAnnotationsModelValidatorProvider?

I have a custom DataAnnotationsModelValidatorProvider for doing model validation in a more dynamic way then just adding attributes. I tried to add my provide to the global.asax.cs like…
sebastiaan
  • 5,870
  • 5
  • 38
  • 68
6
votes
1 answer

Using ninject with Ninject.Web.Api for Web Api 2 is not working in ASP.NET MVC 5

I am developing an Asp.NET MVC project. My project has web api as well. I am using ASP.NET MVC5 and Web Api 2 with Visual Studio 3. I am doing dependency injection using ninject. I know ninject for web is not working for Web Api 2. So I tried to use…
Wai Yan Hein
  • 13,651
  • 35
  • 180
  • 372
1
2 3
19 20