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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 14, 20262026-05-14T01:55:59+00:00 2026-05-14T01:55:59+00:00

I’ve updated a project to VS2010 and MVC2 from VS2008 and MVC1. I’m having

  • 0

I’ve updated a project to VS2010 and MVC2 from VS2008 and MVC1. I’m having problems with Ninject not finding controllers within Areas

Here is my global.asax.cs file:

namespace Website
{
// Note: For instructions on enabling IIS6 or IIS7 classic mode, 
// visit http://go.microsoft.com/?LinkId=9394801

public class MvcApplication : NinjectHttpApplication
{
    public static StandardKernel NinjectKernel;

    public static void RegisterRoutes(RouteCollection routes)
    {
        routes.IgnoreRoute("{resource}.axd/{*pathInfo}");

        routes.MapRoute(
            "Balance",
            "Balance/{action}/{month}/{year}",
            new { controller = "Balance", action = "Index", month = DateTime.Now.Month, year = DateTime.Now.Year }
        );

        routes.MapRoute(
            "Default",                                              // Route name
            "{controller}/{action}/{id}",                           // URL with parameters
            new { controller = "Login", action = "Index", id = "" }  // Parameter defaults
        );

    }

    /*
    protected void Application_Start()
    {
        AreaRegistration.RegisterAllAreas();

        RegisterRoutes(RouteTable.Routes);

        // initializes the NHProfiler so you can see what is going on with your queries
        HibernatingRhinos.Profiler.Appender.NHibernate.NHibernateProfiler.Initialize();
    }
    */

    protected override void OnApplicationStarted()
    {
        RegisterRoutes(RouteTable.Routes);
        AreaRegistration.RegisterAllAreas();
        RegisterAllControllersIn(Assembly.GetExecutingAssembly());
    }

    protected void Application_Error(object sender, EventArgs e)
    {
        var errorService = NinjectKernel.Get<IErrorLogService>();
        errorService.LogError(HttpContext.Current.Server.GetLastError().GetBaseException(), "AppSite");
    }

    protected override IKernel CreateKernel()
    {
        if (NinjectKernel == null)
        {
            NinjectKernel = new StandardKernel(new ServiceModule());
        }

        return NinjectKernel;
    }
}

public class ServiceModule : NinjectModule
{
    public override void Load()
    {
        Bind<IHelper>().To<Helper>().InRequestScope();
        Bind<IErrorLogService>().To<ErrorLogService>();

        Bind<INHSessionFactory>().To<NHSessionFactory>().InSingletonScope();
        Bind<ISessionFactory>().ToMethod(ctx =>
                                         ctx.Kernel.Get<INHSessionFactory>().GetSessionFactory())
                               .InSingletonScope();

        Bind<INHSession>().To<NHSession>();
        Bind<ISession>().ToMethod(ctx => ctx.Kernel.Get<INHSession>().GetSession());
    }
}
}

Accessing controllers within the /Controllers folder works OK, but accessing controllers within a /Areas/Member/Controller throws the following error:

Server Error in '/' Application.

Cannot be null
Parameter name: service

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: System.ArgumentNullException: Cannot be null
Parameter name: service

Source Error: 

An unhandled exception was generated during the execution of the current web request. Information regarding the origin and location of the exception can be identified using the exception stack trace below.

Stack Trace: 
[ArgumentNullException: Cannot be null
Parameter name: service]
Ninject.ResolutionExtensions.GetResolutionIterator(IResolutionRoot root, Type service, Func`2 constraint, IEnumerable`1 parameters, Boolean isOptional, Boolean isUnique) +193
Ninject.Web.Mvc.NinjectControllerFactory.GetControllerInstance(RequestContext requestContext, Type controllerType) +41
System.Web.Mvc.DefaultControllerFactory.CreateController(RequestContext requestContext, String controllerName) +66
System.Web.Mvc.MvcHandler.ProcessRequestInit(HttpContextBase httpContext, IController& controller, IControllerFactory& factory) +124
System.Web.Mvc.MvcHandler.BeginProcessRequest(HttpContextBase httpContext, AsyncCallback callback, Object state) +50
System.Web.Mvc.MvcHandler.BeginProcessRequest(HttpContext httpContext, AsyncCallback callback, Object state) +48
System.Web.Mvc.MvcHandler.System.Web.IHttpAsyncHandler.BeginProcessRequest(HttpContext context, AsyncCallback cb, Object extraData) +16
System.Web.CallHandlerExecutionStep.System.Web.HttpApplication.IExecutionStep.Execute() +8771488
System.Web.HttpApplication.ExecuteStep(IExecutionStep step, Boolean& completedSynchronously) +184

Version Information: Microsoft .NET Framework Version:4.0.30128; ASP.NET     Version:4.0.30128.1

The Url for this request is /Member/Controller/, If I change the Url too /Controller the controller fires but I get an error that the system cannot find the View in the path /Views

When it should be looking in /Area/Members/Views

I have either done something wrong in the upgrade or I’m missing something bt I just can’t figure out what. I’ve been trying to figure this out for 3 days…

  • 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-14T01:56:00+00:00Added an answer on May 14, 2026 at 1:56 am

    Update from the core, I just committed a fix: http://github.com/ninject/ninject.web.mvc

    -Ian

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

Sidebar

Related Questions

link Im having trouble converting the html entites into html characters, (&# 8217;) i
For some reason, after submitting a string like this Jack’s Spindle from a text
I have a string like this: La Torre Eiffel paragonata all&#8217;Everest What PHP function
I'm parsing an RSS feed that has an &#8217; in it. SimpleXML turns this
We're building an app, our first using Rails 3, and we're having to build
I have a text area in my form which accepts all possible characters from
I am currently running into a problem where an element is coming back from
Does anyone know how can I replace this 2 symbol below from the string
I'm trying to decode HTML entries from here NYTimes.com and I cannot figure out
I need a function that will clean a strings' special characters. I do NOT

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.