質問

私はMVC2 RCにMVC1プロジェクトを移行した、と今でサイトがまったく機能しません。私は、エラー「エントリポイントが見つかりませんでした。」を取得

私は<のhref = "http://weblogs.asp.net/leftslipper/archive/2009/10/19/migrating-asp-net-mvc-1-0-applications-to-asp次のプロジェクトを移行しました-net-MVC-2.aspx」のrel = "nofollowをnoreferrer">このリンクする

私は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));

    }

メインコントローラは非常に簡単です、indexアクションは、単に「こんにちは、世界MVC2から」文字列を返します。 (このアクションなしビュー)。

面白いことがある私は、この行をコメントアウトする場合:

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

メインコントローラは正常に動作しますが、原因の他のより複雑なコントローラが何のパラメータなしのコンストラクタがないことを言っていない作品を行います。

だから、それはWindsorControllerFactoryと間違って何かある縫い目ます。

任意のアイデア? おかげ

役に立ちましたか?

解決

使用: 保護されたオーバーライドIController GetControllerInstance(System.Web.Routing.RequestContext RequestContextの、タイプcontrollerType)

Instedの: 保護されたオーバーライドIController GetControllerInstance(タイプcontrollerType)

他のヒント

用途:
保護されたオーバーライドIController GetControllerInstance(System.Web.Routing.RequestContext RequestContextの、タイプcontrollerType)


:の

Insted 保護されたオーバーライドIController GetControllerInstance(タイプcontrollerType)

ライセンス: CC-BY-SA帰属
所属していません StackOverflow
scroll top