views:

932

answers:

2

Hi All,

I've migrated a MVC1 project to MVC2 RC, and now the site doesn't work at all. I get the error "Entry point was not found."

I migrated the project following this link

I'm using Castle Windsor as DI.

Here is a part of global.asax.cs

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

        routes.MapRoute(
            "Default", "{controller}/{action}/{id}", new { controller = "Main", action = "Index", id = "" });
    }

    protected void Application_Start()
    {
        log4net.Config.XmlConfigurator.Configure();
        InitializeServiceLocator();
        //RouteConfigurator.RegisterRoutesTo(RouteTable.Routes);
        AreaRegistration.RegisterAllAreas();
        RegisterRoutes(RouteTable.Routes);

        Bootstrapper.BootStrap();
    }

    /// <summary>
    /// If you need to communicate to multiple databases, you'd add a line to this method to
    /// initialize the other database as well.
    /// </summary>
    private void InitializeNHibernateSession()
    {
        var cfg =
            NHibernateSession.Init(
                webSessionStorage,
                new string[] { Server.MapPath("~/bin/Edi.Advance.EPortfolio.Data.dll") },
                new AutoPersistenceModelGenerator().Generate(),
                Server.MapPath("~/hibernate.cfg.xml")).AddAssembly(typeof(ISoftDeletable).Assembly).AddAssembly(
                typeof(Action).Assembly);

        //cfg.SetListener(ListenerType.Delete, new AdvanceDeleteEventListener(IoC.Resolve<ISecurityContextService>()));
        //cfg.SetListener(ListenerType.SaveUpdate, new AdvanceSaveUpdateEventListener(IoC.Resolve<ISecurityContextService>()));
    }

    /// <summary>
    /// Instantiate the container and add all Controllers that derive from 
    /// WindsorController to the container.  Also associate the Controller 
    /// with the WindsorContainer ControllerFactory.
    /// </summary>
    protected virtual void InitializeServiceLocator()
    {
       // AddComponentsToIoC();
        var container = new WindsorContainer();

        ControllerBuilder.Current.SetControllerFactory(new WindsorControllerFactory(container));
        container.RegisterControllers(typeof(MainController));

        ServiceLocator.SetLocatorProvider(() => new WindsorServiceLocator(container));

    }

MainController is very simple, Index action just return "Hello world from MVC2" string. (No view for this action).

The interesting things is if I comment out this line:

ControllerBuilder.Current.SetControllerFactory(new WindsorControllerFactory(container));

MainController works fine, but of cause other more complicated controllers do not works saying that there is no parameterless constructor.

So it seams that is something wrong with WindsorControllerFactory.

Any ideas? Thanks

+3  A: 

Use:
protected override IController GetControllerInstance(System.Web.Routing.RequestContext requestContext, Type controllerType)

Insted of:
protected override IController GetControllerInstance(Type controllerType)

+3  A: 

Use: protected override IController GetControllerInstance(System.Web.Routing.RequestContext requestContext, Type controllerType)

Insted of: protected override IController GetControllerInstance(Type controllerType)

Khawar

related questions