Asp.net mvc 2 从.NET MVC 1迁移到MVC 2 RC
我已经将一个MVC1项目迁移到MVC2 RC,现在该站点根本无法工作。我得到错误“未找到入口点” 我迁移了以下项目 我用温莎城堡当DI 这是global.asax.cs的一部分Asp.net mvc 2 从.NET MVC 1迁移到MVC 2 RC,asp.net-mvc-2,castle-windsor,Asp.net Mvc 2,Castle Windsor,我已经将一个MVC1项目迁移到MVC2 RC,现在该站点根本无法工作。我得到错误“未找到入口点” 我迁移了以下项目 我用温莎城堡当DI 这是global.asax.cs的一部分 public static void RegisterRoutes(RouteCollection routes) { routes.IgnoreRoute("{resource}.axd/{*pathInfo}"); routes.MapRoute( "
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工作正常,但由于其他更复杂的控制器不工作,所以说没有无参数构造函数
所以说WindsorController工厂出了问题
有什么想法吗?
谢谢使用:受保护的覆盖IController GetControllerInstance(System.Web.Routing.RequestContext RequestContext,类型controllerType) 代替:
受保护的覆盖IController GetControllerInstance(类型controllerType)使用: 受保护的覆盖IController GetControllerInstance(System.Web.Routing.RequestContext RequestContext,类型controllerType) 代替:
受保护的覆盖IController GetControllerInstance(Type controllerType)通过更新MVCContrib和Castle.Windsor librariesHeh解决了问题,输入的错误与用户257138的答案相同
ControllerBuilder.Current.SetControllerFactory(new WindsorControllerFactory(container));