2010-01-05 3 views
4

Я перенес проект MVC1 в MVC2 RC, и теперь сайт вообще не работает. Я получаю сообщение об ошибке «Точка входа не найдена».Миграция из .NET MVC 1 в MVC 2 RC

Я мигрировал проект следующего this link

Я использую замок Виндзор, как DI.

Вот часть 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 очень просто, действие Index просто вернуть "Привет мир от MVC2" строки. (Нет представления для этого действия).

Интересные вещи, если я закомментировать эту строку:

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

MainController работает отлично, но причины и другие более сложные контроллеры не работают говорят, что нет конструктора без параметров.

Так что это швы, что-то не так с WindsorControllerFactory.

Любые идеи? Благодаря

+0

решаемых проблемы путем обновления библиотек MVCContrib и Castle.Windsor – isuruceanu

ответ

3

Использование: protected override IController GetControllerInstance (System.Web.Routing.RequestContext requestContext, Type controllerType)

Insted из: защищаемого переопределения IController GetControllerInstance (тип controllerType)

+0

Хеха, одни и те же опечатки, как в ответе от user257138 –

4

Использование:
защищен переопределение IController GetControllerInstance (System.Web.Routing.RequestContext RequestContext, тип controllerType)

Insted из:
защищен переназначения IController GetControllerInstance (тип controllerType)

Смежные вопросы