Frage

Ich habe ein MVC1 Projekt MVC2 RC gewandert, und jetzt funktioniert die Seite nicht funktionieren. Ich erhalte die Fehlermeldung „Einstiegspunkt wurde nicht gefunden.“

Ich wanderte das Projekt folgende Link

Ich verwende Schloss Windsor als DI.

Hier ist ein Teil von 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 ist sehr einfach, Index Aktion zurückkehren nur „Hallo Welt von MVC2“ string. (Kein Blick für diese Aktion).

Die interessanten Dinge sind, wenn ich diese Zeile aus kommentieren:

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

MainController funktioniert gut, aber von anderen Ursache komplizierter Controller nicht funktioniert sagen, dass es keinen parameterlosen Konstruktor ist.

So ist es, dass Nähte ist etwas falsch mit WindsorControllerFactory.

Irgendwelche Ideen? Dank

War es hilfreich?

Lösung

Verwendung: protected override IRegler GetControllerInstance (System.Web.Routing.RequestContext Request, Typ controller)

Insted von: protected override IRegler GetControllerInstance (Typ controller)

Andere Tipps

Verwendung:
protected override IRegler GetControllerInstance (System.Web.Routing.RequestContext Request, Typ controller)

Insted von:
protected override IRegler GetControllerInstance (Typ controller)

Lizenziert unter: CC-BY-SA mit Zuschreibung
Nicht verbunden mit StackOverflow
scroll top