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 7749985
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 1, 20262026-06-01T11:10:25+00:00 2026-06-01T11:10:25+00:00

I create a new ASP.NET Web API project. I then use nuget to pull

  • 0

I create a new ASP.NET Web API project. I then use nuget to pull Ninject.Web.Common, then I download and build Ninject.Web.WebApi from here. Included it in the project. I added a service and the injection via constructor, setup binding (the debugger shows that the code actually hits the bind) but still throws this error:

Error activating IValueService
No matching bindings are available, and the type is not self-bindable.
Activation path:
  2) Injection of dependency IValueService into parameter valueService of constructor of type ValuesController
  1) Request for ValuesController

Suggestions:
  1) Ensure that you have defined a binding for IValueService.
  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.

Libraries in my project:

  1. Ninject.dll
  2. Ninject.Web.Common
  3. Ninject.Web.Webapi
  4. WebActivator

All ninject libraries are marked as version 3.

Here is the Code:

[assembly: WebActivator.PreApplicationStartMethod(typeof(MvcApplication3.App_Start.NinjectWebCommon), "Start")]
[assembly: WebActivator.ApplicationShutdownMethodAttribute(typeof(MvcApplication3.App_Start.NinjectWebCommon), "Stop")]
namespace MvcApplication3.App_Start
{
using System;
using System.Web;

using Microsoft.Web.Infrastructure.DynamicModuleHelper;

using Ninject;
using Ninject.Web.Common;

public static class NinjectWebCommon 
{
    private static readonly Bootstrapper bootstrapper = new Bootstrapper();

    /// <summary>
    /// Starts the application
    /// </summary>
    public static void Start() 
    {
        DynamicModuleUtility.RegisterModule(typeof(OnePerRequestHttpModule));
        DynamicModuleUtility.RegisterModule(typeof(NinjectHttpModule));
        bootstrapper.Initialize(CreateKernel);
    }

    /// <summary>
    /// Stops the application.
    /// </summary>
    public static void Stop()
    {
        bootstrapper.ShutDown();
    }

    /// <summary>
    /// Creates the kernel that will manage your application.
    /// </summary>
    /// <returns>The created kernel.</returns>
    private static IKernel CreateKernel()
    {
        var kernel = new StandardKernel();
        kernel.Bind<Func<IKernel>>().ToMethod(ctx => () => new Bootstrapper().Kernel);
        kernel.Bind<IHttpModule>().To<HttpApplicationInitializationHttpModule>();

        RegisterServices(kernel);
        return kernel;
    }

    /// <summary>
    /// Load your modules or register your services here!
    /// </summary>
    /// <param name="kernel">The kernel.</param>
    private static void RegisterServices(IKernel kernel)
    {

        kernel.Bind<IValueService>().To<ValueService>();
    }        
}

}

service:

public interface IValueService
{
    List<string> GetStrings();
}

public class ValueService : IValueService
{
    public List<string> GetStrings()
    {
        return new List<string>{"test", "test"};
    }
}

controller:

public class ValuesController : ApiController
{
    private readonly IValueService valueService;

    // GET /api/values
    public ValuesController(IValueService valueService)
    {
        this.valueService = valueService;
    }
}

The downloaded project sample from github works but not when I create a new project. Am I missing a step?

  • 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-06-01T11:10:27+00:00Added an answer on June 1, 2026 at 11:10 am

    I just checked that there is no issue with this extension (at least not with the lastest MVC4 preview):

    • Create a new MVC4 WEB Api project
    • Nuget Install-Package Ninject.Web.WebAPI
    • Change controller + add bindings

    Your code looks good. There must be a problem somewhere else.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I create new ASP.NET web application that use SMTP to send message. The problem
In VS2008, I go to File/New/Project, select ASP.NET Web Application and create a new
What assemblies are loaded by default when you create a new ASP.NET 2.0 Web
When I start a new ASP.NET project in Visual Studio, I can create an
If you create a new ASP.NET MVC 2 Web Application and run it, you
I have two folders in my asp.net web application in which I create new
I'm creating a web API based on the new ASP.NET Web API. I'm trying
I'm researching the new ASP.NET MVC4 Web API framework. I'm running Visual Studio 2011
I create new asp.net mvc 3 project. Copy there all controllers, classes and views
Create a new ASP.NET MVC Web Application Create an ASP.NET App_Code Folder Inside the

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.