Reputation: 3250
I have an asp.net mvc 1.0 project. I upgraded the project and solution to Visual Studio 2010. However, I do not want to use asp.net mvc 2.0. My app compiles under mvc 1.0. All my references are to 1.0. I have copy local true and i am referencing mvc 1.0 from a lib folder, not the GAC.
However I keep getting this error:
No parameterless constructor defined for this object.
Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code.
Exception Details: System.MissingMethodException: No parameterless constructor defined for this object.
Source Error:
An unhandled exception was generated during the execution of the current web request. Information regarding the origin and location of the exception can be identified using the exception stack trace below.
Stack Trace:
[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(Type controllerType) +82
[InvalidOperationException: An error occurred while creating a controller of type 'PartingOut.Web.Controllers.HomeController'. If the controller doesn't have a controller factory, ensure that it has a parameterless public constructor.]
System.Web.Mvc.DefaultControllerFactory.GetControllerInstance(Type controllerType) +189
System.Web.Mvc.DefaultControllerFactory.CreateController(RequestContext requestContext, String controllerName) +74
System.Web.Mvc.MvcHandler.ProcessRequest(HttpContextBase httpContext) +128
System.Web.Mvc.MvcHandler.ProcessRequest(HttpContext httpContext) +57
System.Web.Mvc.MvcHandler.System.Web.IHttpHandler.ProcessRequest(HttpContext httpContext) +7
System.Web.CallHandlerExecutionStep.System.Web.HttpApplication.IExecutionStep.Execute() +181
System.Web.HttpApplication.ExecuteStep(IExecutionStep step, Boolean& completedSynchronously) +75
Its like it wants to keep using asp.net mvc 2.0, because its complaining about that GetControllerInstance method.
This project works fine in vs 2008. wahhh! :(
Anyone? Anyone?
Thanks in advance.
Upvotes: 1
Views: 288
Reputation: 3250
I figured it out.
Nothing to do with asp.net mvc 2 or vs 2010. It was still referencing asp.net mvc 1.0 fine. One of the other developers had done the upgrade and took out the "overrides" keyword in the method:
IController GetControllerInstance(Type controllerType)
on our own custom ControllerFactory.
Meh.
Upvotes: 1
Reputation: 15334
I'm just trying to cover all the bases here, so forgive me if this is an obvious answer, but: Does PartingOut.Web.Controllers.HomeController
actually have a parameterless constructor?
Upvotes: 1