我们当前的项目是用 ASP.NET MVC 1 编写的,使用用于 IOC/DI 的 mvc-turbines(和统一)。
当我尝试从 2008 年启动应用程序时,一切正常,但从 2010 年开始,我不断收到“无参数构造函数”错误。
为什么?两者都针对相同的 .Net 框架。VS 2010 解决方案继续使用默认控制器工厂。有什么建议可以调试吗?
[MissingMethodException: No parameterless constructor defined for this object.]
System.RuntimeTypeHandle.CreateInstance(RuntimeType type, Boolean publicOnly, Boolean noCheck, Boolean& canBeCached, RuntimeMethodHandle& ctor, Boolean& bNeedSecurityCheck) +0
System.RuntimeType.CreateInstanceSlow(Boolean publicOnly, Boolean fillCache) +86
System.RuntimeType.CreateInstanceImpl(Boolean publicOnly, Boolean skipVisibilityChecks, Boolean fillCache) +230
System.Activator.CreateInstance(Type type, Boolean nonPublic) +67
System.Web.Mvc.DefaultControllerFactory.GetControllerInstance(RequestContext requestContext, Type controllerType) +80
[InvalidOperationException: An error occurred when trying to create a controller of type 'CommonProject.Web.Shared.Controllers.MyController'. Make sure that the controller has a parameterless public constructor.]
System.Web.Mvc.DefaultControllerFactory.GetControllerInstance(RequestContext requestContext, Type controllerType) +190
System.Web.Mvc.DefaultControllerFactory.CreateController(RequestContext requestContext, String controllerName) +68
System.Web.Mvc.MvcHandler.ProcessRequestInit(HttpContextBase httpContext, IController& controller, IControllerFactory& factory) +118
System.Web.Mvc.MvcHandler.ProcessRequest(HttpContextBase httpContext) +46
System.Web.Mvc.MvcHandler.ProcessRequest(HttpContext httpContext) +57
System.Web.Mvc.MvcHandler.System.Web.IHttpHandler.ProcessRequest(HttpContext httpContext) +7
System.Web.Mvc.MvcHttpHandler.VerifyAndProcessRequest(IHttpHandler httpHandler, HttpContextBase httpContext) +61
System.Web.Routing.UrlRoutingHandler.ProcessRequest(HttpContextBase httpContext) +111
System.Web.Routing.UrlRoutingHandler.ProcessRequest(HttpContext httpContext) +40
System.Web.Routing.UrlRoutingHandler.System.Web.IHttpHandler.ProcessRequest(HttpContext context) +7
CommonProject.Web._Default.Page_Load(Object sender, EventArgs e) in