我已经将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很简单,指数只是行动 “从MVC2 Hello World” 的字符串返回。 (对此操作没有看法)。
的有趣的事情是,如果我注释掉这一行:
ControllerBuilder.Current.SetControllerFactory(new WindsorControllerFactory(container));
MainController工作正常,但导致其他更复杂的控制器不工作说,没有参数的构造函数。
因此它与WindsorControllerFactory出现问题。
任何想法? 感谢
通过更新MVCContrib和Castle.Windsor库解决了该问题 – isuruceanu 2010-01-05 10:20:12