문제

나는 마이그레이션 MVC1 프로젝트를 MVC2RC,그리고 지금은 사이트에서 작동하지 않는다.나는 오류"항목점을 찾을 수 없습니다."

나는 마이그레이션 프로젝트를 다음 이 링크

나는 성 윈저를 사용하여으로 DI.

여기에는 일부의 글로벌입니다.맨.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 은 매우 간단하고,인덱스 작업이 그냥 return"Hello world 에서 MVC2"문자열입니다.(더 보기 이 작업).

흥미로운 것들입니다면 코멘트이 라인:

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

MainController 을 잘 하지만의 원인이 더 복잡한 다른 컨트롤러하지 않 작품을 말하는 없다는 것을 매개 변수가 없는 생성자입니다.

그래서 그 솔기가 있는 뭔가 잘못 WindsorControllerFactory.

어떤 아이디어가?감사

도움이 되었습니까?

해결책

를 사용:보호된 재정의 IController GetControllerInstance(시스템입니다.웹.라우팅이라고 합니다.RequestContext requestContext 입력 할 수있)

필:보호된 재정의 IController GetControllerInstance(입력 할 수있)

다른 팁

를 사용:
보호된 재정의 IController GetControllerInstance(시스템입니다.웹.라우팅이라고 합니다.RequestContext requestContext 입력 할 수있)

필:
보호된 재정의 IController GetControllerInstance(입력 할 수있)

라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 StackOverflow
scroll top