Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 7687337
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 31, 20262026-05-31T19:40:53+00:00 2026-05-31T19:40:53+00:00

I installed Ninject via nuget, and I registered my binds in NinjectMVC3’s RegisterServices method

  • 0

I installed Ninject via nuget, and I registered my binds in NinjectMVC3’s RegisterServices method (created by nuget). Follow my code:

private static void RegisterServices(IKernel kernel)
{   
    kernel.Bind<IUnitOfWork>().To<UnitOfWork>();
    kernel.Bind<IRepository<Action>>().To<ActionRepository>();
    kernel.Bind<IRepository<ActionType>>().To<ActionTypeRepository>();
    kernel.Bind<IRepository<City>>().To<CityRepository>();
    kernel.Bind<IRepository<Country>>().To<CountryRepository>();
    kernel.Bind<IRepository<Goods>>().To<GoodsRepository>();
    kernel.Bind<IRepository<Media>>().To<MediaRepository>();
    kernel.Bind<IRepository<MediaType>>().To<MediaTypeRepository>();
    kernel.Bind<IRepository<Ranking>>().To<RankingRepository>();
    kernel.Bind<IRepository<Role>>().To<RoleRepository>();
    kernel.Bind<IRepository<Sponsor>>().To<SponsorRepository>();
    kernel.Bind<IRepository<State>>().To<StateRepository>();
    kernel.Bind<IRepository<UserAccountInfo>>().To<UserAccountInfoRepository>();
    kernel.Bind<IRepository<UserAction>>().To<UserActionRepository>();
    kernel.Bind<IRepository<UserDeservesGoods>>().To<UserDeservesGoodsRepository>();
    kernel.Bind<IRepository<UserGoods>>().To<UserGoodsRepository>();
    kernel.Bind<IRepository<User>>().To<UserRepository>();
    kernel.Bind<IUserService>().To<UserService>();
    kernel.Bind<IAccountService>().To<AccountService>();

    DependencyResolver.SetResolver(new NinjectDependencyResolver(kernel));
}     

here is my HomeController:

readonly IRepository<Ranking> repoRanking;
public HomeController(IRepository<Ranking> repoRanking)
{
    this.repoRanking = repoRanking;
}

When I execute HomeController, I get follow exception:

Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code. 

Exception Details: Ninject.ActivationException: Error activating IRepository{Ranking}
No matching bindings are available, and the type is not self-bindable.
Activation path:
 2) Injection of dependency IRepository{Ranking} into parameter repoRanking of constructor of type HomeController
 1) Request for HomeController

Suggestions:
 1) Ensure that you have defined a binding for IRepository{Ranking}.
 2) If the binding was defined in a module, ensure that the module has been loaded into the kernel.
 3) Ensure you have not accidentally created more than one kernel.
 4) If you are using constructor arguments, ensure that the parameter name matches the constructors parameter name.
 5) If you are using automatic module loading, ensure the search path and filters are correct.

What I doing wrong?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-31T19:40:54+00:00Added an answer on May 31, 2026 at 7:40 pm

    Have you created a default module where you set your bindings instead of in the register services method?

     public class DefaultModule : NinjectModule {
        public override void Load() {
            Bind<IProductService>().To<ProductService>().InTransientScope();
        }
     }
    

    and then in your Global.asax file do this:

     protected override IKernel CreateKernel() {
      var kernel = new StandardKernel();
    
      kernel.Load(Assembly.GetExecutingAssembly());
    
     return kernel;
     }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I installed on my project Ninject.MVC3 via Nuget. I read this article that to
I have created an ASP.Net MVC Web Application and used NuGet to install Ninject
I created a new project of type Asp.net MVC 4 I installed the package
Installed SlikSvn on Window 2008 server Created Repository at c:\dia\svn\repos running this windows service
I installed my rails-app via Passenger on my apache but I'm getting a strange
I have a package Ninject.Extensisons.Wcf which shall be installed differently depending on the type
Installed Git and created heroku account for use with a facebook app unable to
I installed NERDTree via Pathogen on Mac OSX 10.6.8. When I vim a dir,
I am working on an ASP .NET Mvc 3 App and have installed Ninject.Mvc3
Installed Tomcat 6 Installed Eclipse + GWT plugin Created GWT project with sample generated

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.