No parameterless constructor defined for this object.

This topic was automatically closed 365 days after the last reply. New replies are no longer allowed.
11 years ago
I just downloaded 2.80 version and run (no changes).
I have got such error on install action.
Please, tell me what is wrong with my environment (installed all versions of MVC).



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, RuntimeMethodHandleInternal& ctor, Boolean& bNeedSecurityCheck) +0
   System.RuntimeType.CreateInstanceSlow(Boolean publicOnly, Boolean skipCheckThis, Boolean fillCache, StackCrawlMark& stackMark) +113
   System.RuntimeType.CreateInstanceDefaultCtor(Boolean publicOnly, Boolean skipCheckThis, Boolean fillCache, StackCrawlMark& stackMark) +232
   System.Activator.CreateInstance(Type type, Boolean nonPublic) +83
   System.Activator.CreateInstance(Type type) +6
   System.Web.Mvc.DefaultControllerActivator.Create(RequestContext requestContext, Type controllerType) +55

[InvalidOperationException: An error occurred when trying to create a controller of type 'Nop.Web.Controllers.InstallController'. Make sure that the controller has a parameterless public constructor.]
   System.Web.Mvc.DefaultControllerActivator.Create(RequestContext requestContext, Type controllerType) +179
   System.Web.Mvc.DefaultControllerFactory.GetControllerInstance(RequestContext requestContext, Type controllerType) +80
   System.Web.Mvc.DefaultControllerFactory.CreateController(RequestContext requestContext, String controllerName) +74
   System.Web.Mvc.MvcHandler.ProcessRequestInit(HttpContextBase httpContext, IController& controller, IControllerFactory& factory) +197
   System.Web.Mvc.MvcHandler.BeginProcessRequest(HttpContextBase httpContext, AsyncCallback callback, Object state) +49
   System.Web.Mvc.MvcHandler.BeginProcessRequest(HttpContext httpContext, AsyncCallback callback, Object state) +50
   System.Web.Mvc.MvcHandler.System.Web.IHttpAsyncHandler.BeginProcessRequest(HttpContext context, AsyncCallback cb, Object extraData) +16
   System.Web.CallHandlerExecutionStep.System.Web.HttpApplication.IExecutionStep.Execute() +301
   System.Web.HttpApplication.ExecuteStep(IExecutionStep step, Boolean& completedSynchronously) +155
11 years ago
Any guidance will be greatly appreciated.
I haven't got any answer yet. Here are the details of my environment.
VS ultimate 10/11 (package with source code), .installed .net 2/3/4/4.5 and MVC 2/3/4. Win 7 x64


When i run Nop.Web of version 2.65/2.7/2.8, i have got the following message in method FindClassesOfType
Unable to load one or more of the requested types. Retrieve the LoaderExceptions property for more information.
innerexception is
Could not load file or assembly 'System.Web.Mvc, Version=1.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35' or one of its dependencies. The located assembly's manifest definition does not match the assembly reference. (Exception from HRESULT: 0x80131040)

After that i tried to install MVC 1 and got following 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.


Thanks in advance
11 years ago
Hi,

Are you sure you have not customized any of the nopCommerce code?
The No Parameterless construct could be due to Autofac not being able to resolve the dependency of the InstallController, which is IInstallationLocalizationService.

As to the other error you are getting it simply means that the .NET loader is not being able to find the assembly referenced.
Check that your reference to System.Web.MVC is being resoved from here:

\packages\Microsoft.AspNet.Mvc.4.0.20710.0\lib\net40\System.Web.Mvc.dll
11 years ago
Thank you very much for quick response.
I'm sure . I just downloaded nopCommerce 2.80 - Source code extracted it and run ( I haven't done any changes).

Also checked the references to System.Web.MVC is being resolved from here
\packages\Microsoft.AspNet.Mvc.4.0.20710.0\lib\net40\System.Web.Mvc.dll

I guess something wrong with my environmental but unfortunately i getting those error and on my work's laptop and on my home's laptop.

Any idea to check my environment ?

Thanks in advance
11 years ago
Autofac 2.6.3.862 and Autofac ASP.NET MVC3 Integration 2.6.3.862 installed as well

please provide me how can i fix this issue.

Thanks in advance
7 years ago
Did anyone solve this?
I am on version 3.8 and it was working fine all day but now will not open the admin page. It just gives the below but the opening appears to be exactly the same error, if three years later. I have tried removing any new plugins and restoring all the system files but as I haven't changed anything it seems a bit pointless:


Server Error in '/' Application.
--------------------------------------------------------------------------------


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, RuntimeMethodHandleInternal& ctor, Boolean& bNeedSecurityCheck) +0
   System.RuntimeType.CreateInstanceSlow(Boolean publicOnly, Boolean skipCheckThis, Boolean fillCache, StackCrawlMark& stackMark) +138
   System.Activator.CreateInstance(Type type, Boolean nonPublic) +105
   System.Activator.CreateInstance(Type type) +12
   System.Web.Mvc.DefaultControllerActivator.Create(RequestContext requestContext, Type controllerType) +73

[InvalidOperationException: An error occurred when trying to create a controller of type 'Nop.Admin.Controllers.HomeController'. Make sure that the controller has a parameterless public constructor.]
   System.Web.Mvc.DefaultControllerActivator.Create(RequestContext requestContext, Type controllerType) +240
   System.Web.Mvc.DefaultControllerFactory.CreateController(RequestContext requestContext, String controllerName) +103
   System.Web.Mvc.MvcHandler.ProcessRequestInit(HttpContextBase httpContext, IController& controller, IControllerFactory& factory) +267
   System.Web.Mvc.MvcHandler.BeginProcessRequest(HttpContextBase httpContext, AsyncCallback callback, Object state) +95
   System.Web.CallHandlerExecutionStep.System.Web.HttpApplication.IExecutionStep.Execute() +921
   System.Web.HttpApplication.ExecuteStep(IExecutionStep step, Boolean& completedSynchronously) +137

  


--------------------------------------------------------------------------------
Version Information: Microsoft .NET Framework Version:4.0.30319; ASP.NET Version:4.6.1055.0
7 years ago
Usually when the admin page returns a page not found error, you should clean and rebuild the source and the error goes away.
Are you able to rebuild the Nop.Admin?
This topic was automatically closed 365 days after the last reply. New replies are no longer allowed.