Skip to content

No parameterless constructor defined for this object - Only when deployed #16

@MilesHart

Description

@MilesHart

Everything works fine in local dev, however when I deploy to a server (literally changing nothing) I get the parameterless constructor error:

`[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 'XXX.XXX.Web.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
Castle.Proxies.Invocations.IControllerFactory_CreateController.InvokeMethodOnTarget() +154
Castle.DynamicProxy.AbstractInvocation.Proceed() +111
Glimpse.Core.Extensions.AlternateMethodContextExtensions.TryProceedWithTimer(IAlternateMethodContext context, TimerResult& timerResult) +64
Glimpse.Core.Extensibility.AlternateMethod.NewImplementation(IAlternateMethodContext context) +32
Castle.DynamicProxy.AbstractInvocation.Proceed() +448
Castle.Proxies.IControllerFactoryProxy.CreateController(RequestContext requestContext, String controllerName) +270
System.Web.Mvc.MvcHandler.ProcessRequestInit(HttpContextBase httpContext, IController& controller, IControllerFactory& factory) +268
System.Web.Mvc.MvcHandler.BeginProcessRequest(HttpContextBase httpContext, AsyncCallback callback, Object state) +95
System.Web.CallHandlerExecutionStep.System.Web.HttpApplication.IExecutionStep.Execute() +923
System.Web.HttpApplication.ExecuteStep(IExecutionStep step, Boolean& completedSynchronously) +137`

Running: -

structuremap v3.1.1.134
StrucureMap.MVC5 v3.1.1.134
Structuremap.web v3.1.0.133

Has anyone else got this problem?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions