The type or namespace could not be found.

In Vs2010 project I have an mvc repository which gives the following errors:
1) The type or namespace name 'OnePerRequestModule' could not be found
2) The type or namespace name 'HttpApplicationInitializationModule' could not be found
(are you missing a using directive or an assembly reference?)
I have searched the internet and have been unable to find a workable solution.
Thanks in advance for any help given.
For clarity, below is the code I have:
NinjectMVC3.cs
using Ninject.Web.Common;

[assembly: WebActivator.PreApplicationStartMethod(typeof(GenericRepoWebApp.App_Start.NinjectMVC3), "Start")]
//[assembly: WebActivator.PreApplicationStartMethod(typeof(GenericRepoWebApp.App_Start.NinjectMVC3), "Start")]
[assembly: WebActivator.ApplicationShutdownMethodAttribute(typeof(GenericRepoWebApp.App_Start.NinjectMVC3), "Stop")]    
//[assembly: WebActivator.PostApplicationStartMethod(typeof(GenericRepoWebApp.App_Start.NinjectMVC3), "PostStart")]

//[assembly: WebActivator.PostApplicationStartMethod(typeof(GenericRepoWebApp.App_Start.NinjectMVC3), "OnApplicationStarted")]

namespace GenericRepoWebApp.App_Start
{
    using System.Reflection;
    using GenericRepoWebApp.Data.DataAccess.Infrastructure;
    using GenericRepoWebApp.Data.DataAccess.SqlServer;
    using Microsoft.Web.Infrastructure.DynamicModuleHelper;
    using Ninject;
    using Ninject.Web.Mvc;

    public static class NinjectMVC3 
    {
        private static readonly Bootstrapper bootstrapper = new Bootstrapper();
        /// <summary>
        /// Starts the application
        /// </summary>
        public static void Start() 
        {
            Microsoft.Web.Infrastructure.DynamicModuleHelper.DynamicModuleUtility.RegisterModule(typeof(OnePerRequestModule));// Error this line 27
            Microsoft.Web.Infrastructure.DynamicModuleHelper.DynamicModuleUtility.RegisterModule(typeof(HttpApplicationInitializationModule));// Error this line 28
            bootstrapper.Initialize(CreateKernel);
        }
        public static void PostStart()
        {
            bootstrapper.Initialize(CreateKernel);
        }
        /// <summary>
        /// Application started.
        /// </summary>
        public static void OnApplicationStarted()
        {
        // Do your bindings here.
        }
        /// <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();
            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<IFooRepository>().To<FooRepository>();
            kernel.Bind<IBarRepository>().To<BarReposiltory>();
        }        
    }
}

Open in new window

Global.asax.cs
public class MvcApplication : System.Web.HttpApplication
    {
        public static void RegisterGlobalFilters(GlobalFilterCollection filters)
        {
            filters.Add(new HandleErrorAttribute());
        }
        public static void RegisterRoutes(RouteCollection routes)
        {
            routes.IgnoreRoute("{resource}.axd/{*pathInfo}");

            routes.MapRoute(
                "Default", // Route name
                "{controller}/{action}/{id}", // URL with parameters
                new { controller = "Foo", action = "Index", id = UrlParameter.Optional } // Parameter defaults
            );
        }
        protected void Application_Start()
        {
            AreaRegistration.RegisterAllAreas();
            RegisterGlobalFilters(GlobalFilters.Filters);
            RegisterRoutes(RouteTable.Routes);
        }
}

Open in new window

homeshopperAsked:
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

David Johnson, CD, MVPOwnerCommented:
you have to search your solution folders for that module and add it to your solution
0
Fernando SotoRetiredCommented:
You have these two types OnePerRequestModule and HttpApplicationInitializationModule defined in your code somewhere. If they are in a different project with in the solution you will need to add a reference to those project in this code where you are getting the error so that the project having the errors will have access to the code.

If it is happening in the same project as the code that is getting the error then it most likely is in a different namespace so add the namespace to the code file having the issue.
0

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
homeshopperAuthor Commented:
Thank you for your suggestion.
I did search the entire project for any other occurrence for OnePerRequestModule
and HttpApplicationInitializationModule, but none was found.
Rereading your suggestion again, made me realize that it might be part of Ninject.
I started a new project, installed Ninject which created a file called NinjectWebCommon.
I did not include the original file NinjectMVC3 which was causing the error.
I then added the code below to the file NinjectWebCommon:
It cured the original error, but now have a different one.
So I am closing this question and awarding the points.
Then I'll open a new one for the new error.
private static void RegisterServices(IKernel kernel)
        {
            kernel.Bind<IFooRepository>().To<FooRepository>();
            kernel.Bind<IBarRepository>().To<BarReposiltory>();
        }  

Open in new window

0
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
ASP.NET

From novice to tech pro — start learning today.

Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.