asp.net - Activation error occurred while trying to get instance of type AccountController, key \"\"" -
that's accountcontroller
:
[authorize] public class accountcontroller : controller { private usermanager<user> _usermanager { get; set; } public accountcontroller() : this(new usermanager<user>(new userstore())) {} public accountcontroller(usermanager<user> usermanager) { _usermanager = usermanager; } }
and stack trace:
microsoft.practices.servicelocation.activationexception unhandled user code hresult=-2146233088 message=activation error occurred while trying instance of type accountcontroller, key "" source=microsoft.practices.servicelocation stacktrace: @ microsoft.practices.servicelocation.servicelocatorimplbase.getinstance(type servicetype, string key) in c:\projects\commonservicelocator\main\microsoft.practices.servicelocation\servicelocatorimplbase.cs:line 53 @ microsoft.practices.servicelocation.servicelocatorimplbase.getinstance(type servicetype) in c:\projects\commonservicelocator\main\microsoft.practices.servicelocation\servicelocatorimplbase.cs:line 34 @ system.web.mvc.dependencyresolver.delegatebaseddependencyresolver.getservice(type type) innerexception: structuremap.structuremapexception hresult=-2146232832 message=structuremap exception code: 202 no default instance defined pluginfamily microsoft.aspnet.identity.iuserstore`1[[fables.bll.entities.user, fables.bll, version=1.0.0.0, culture=neutral, publickeytoken=null]], microsoft.aspnet.identity.core, version=1.0.0.0, culture=neutral, publickeytoken=31bf3856ad364e35 source=structuremap errorcode=202 stacktrace: @ structuremap.buildsession.<.ctor>b__0(type t) in c:\buildagent\work\767273992e840853\src\structuremap\buildsession.cs:line 33 @ structuremap.util.cache`2.get_item(key key) in c:\buildagent\work\767273992e840853\src\structuremap\util\cache.cs:line 83 @ structuremap.buildsession.createinstance(type plugintype) in c:\buildagent\work\767273992e840853\src\structuremap\buildsession.cs:line 215 @ structuremap.pipeline.defaultinstance.build(type plugintype, buildsession session) in c:\buildagent\work\767273992e840853\src\structuremap\pipeline\defaultinstance.cs:line 22 @ structuremap.pipeline.instance.createrawobject(type plugintype, buildsession session) in c:\buildagent\work\767273992e840853\src\structuremap\pipeline\instance.cs:line 103 @ structuremap.pipeline.instance.build(type plugintype, buildsession session) in c:\buildagent\work\767273992e840853\src\structuremap\pipeline\instance.cs:line 69 @ structuremap.pipeline.constructorinstance.get(string propertyname, type plugintype, buildsession session) in c:\buildagent\work\767273992e840853\src\structuremap\pipeline\constructorinstance.cs:line 74 @ structuremap.pipeline.constructorinstance.get[t](string propertyname, buildsession session) in c:\buildagent\work\767273992e840853\src\structuremap\pipeline\constructorinstance.cs:line 79 @ structuremap.pipeline.arguments.get[t](string propertyname) in c:\buildagent\work\767273992e840853\src\structuremap\pipeline\arguments.cs:line 18 @ lambda_method(closure , iarguments ) @ structuremap.construction.buildercompiler.funccompiler`1.<>c__displayclass2.<createbuilder>b__0(iarguments args) in c:\buildagent\work\767273992e840853\src\structuremap\construction\buildercompiler.cs:line 56 @ structuremap.construction.instancebuilder.buildinstance(iarguments args) in c:\buildagent\work\767273992e840853\src\structuremap\construction\instancebuilder.cs:line 34 @ structuremap.pipeline.constructorinstance.build(type plugintype, buildsession session, iinstancebuilder builder) in c:\buildagent\work\767273992e840853\src\structuremap\pipeline\constructorinstance.cs:line 237 @ structuremap.pipeline.constructorinstance.build(type plugintype, buildsession session) in c:\buildagent\work\767273992e840853\src\structuremap\pipeline\constructorinstance.cs:line 218 @ structuremap.pipeline.instance.createrawobject(type plugintype, buildsession session) in c:\buildagent\work\767273992e840853\src\structuremap\pipeline\instance.cs:line 103 @ structuremap.pipeline.instance.build(type plugintype, buildsession session) in c:\buildagent\work\767273992e840853\src\structuremap\pipeline\instance.cs:line 69 @ structuremap.pipeline.objectbuilder.constructnew(type plugintype, instance instance, buildsession session) in c:\buildagent\work\767273992e840853\src\structuremap\pipeline\objectbuilder.cs:line 39 @ structuremap.pipeline.objectbuilder.resolve(type plugintype, instance instance, buildsession session) in c:\buildagent\work\767273992e840853\src\structuremap\pipeline\objectbuilder.cs:line 27 @ structuremap.buildsession.createinstance(type plugintype, instance instance) in c:\buildagent\work\767273992e840853\src\structuremap\buildsession.cs:line 176 @ structuremap.buildsession.<>c__displayclass3.<.ctor>b__1() in c:\buildagent\work\767273992e840853\src\structuremap\buildsession.cs:line 36 @ structuremap.buildsession.createinstance(type plugintype) in c:\buildagent\work\767273992e840853\src\structuremap\buildsession.cs:line 215 @ structuremap.pipeline.defaultinstance.build(type plugintype, buildsession session) in c:\buildagent\work\767273992e840853\src\structuremap\pipeline\defaultinstance.cs:line 22 @ structuremap.pipeline.instance.createrawobject(type plugintype, buildsession session) in c:\buildagent\work\767273992e840853\src\structuremap\pipeline\instance.cs:line 103 @ structuremap.pipeline.instance.build(type plugintype, buildsession session) in c:\buildagent\work\767273992e840853\src\structuremap\pipeline\instance.cs:line 69 @ structuremap.pipeline.constructorinstance.get(string propertyname, type plugintype, buildsession session) in c:\buildagent\work\767273992e840853\src\structuremap\pipeline\constructorinstance.cs:line 74 @ structuremap.pipeline.constructorinstance.get[t](string propertyname, buildsession session) in c:\buildagent\work\767273992e840853\src\structuremap\pipeline\constructorinstance.cs:line 79 @ structuremap.pipeline.arguments.get[t](string propertyname) in c:\buildagent\work\767273992e840853\src\structuremap\pipeline\arguments.cs:line 18 @ lambda_method(closure , iarguments ) @ structuremap.construction.buildercompiler.funccompiler`1.<>c__displayclass2.<createbuilder>b__0(iarguments args) in c:\buildagent\work\767273992e840853\src\structuremap\construction\buildercompiler.cs:line 56 @ structuremap.construction.instancebuilder.buildinstance(iarguments args) in c:\buildagent\work\767273992e840853\src\structuremap\construction\instancebuilder.cs:line 34 @ structuremap.pipeline.constructorinstance.build(type plugintype, buildsession session, iinstancebuilder builder) in c:\buildagent\work\767273992e840853\src\structuremap\pipeline\constructorinstance.cs:line 237 @ structuremap.pipeline.constructorinstance.build(type plugintype, buildsession session) in c:\buildagent\work\767273992e840853\src\structuremap\pipeline\constructorinstance.cs:line 218 @ structuremap.pipeline.instance.createrawobject(type plugintype, buildsession session) in c:\buildagent\work\767273992e840853\src\structuremap\pipeline\instance.cs:line 103 @ structuremap.pipeline.instance.build(type plugintype, buildsession session) in c:\buildagent\work\767273992e840853\src\structuremap\pipeline\instance.cs:line 69 @ structuremap.pipeline.objectbuilder.constructnew(type plugintype, instance instance, buildsession session) in c:\buildagent\work\767273992e840853\src\structuremap\pipeline\objectbuilder.cs:line 39 @ structuremap.pipeline.objectbuilder.resolve(type plugintype, instance instance, buildsession session) in c:\buildagent\work\767273992e840853\src\structuremap\pipeline\objectbuilder.cs:line 27 @ structuremap.buildsession.createinstance(type plugintype, instance instance) in c:\buildagent\work\767273992e840853\src\structuremap\buildsession.cs:line 176 @ structuremap.buildsession.<>c__displayclass3.<.ctor>b__1() in c:\buildagent\work\767273992e840853\src\structuremap\buildsession.cs:line 36 @ structuremap.buildsession.createinstance(type plugintype) in c:\buildagent\work\767273992e840853\src\structuremap\buildsession.cs:line 215 @ structuremap.container.getinstance(type plugintype) in c:\buildagent\work\767273992e840853\src\structuremap\container.cs:line 265 @ fables.web.dependencyresolution.structuremapdependencyscope.dogetinstance(type servicetype, string key) in f:\myprojects\fables\fables\fables.web\dependencyresolution\structuremapdependencyscope.cs:line 123 @ microsoft.practices.servicelocation.servicelocatorimplbase.getinstance(type servicetype, string key) in c:\projects\commonservicelocator\main\microsoft.practices.servicelocation\servicelocatorimplbase.cs:line 49 innerexception:
can explain please, exception mean , how resolve it? ty.
your app using second constructor structuremap will automatically select "greediest" public constructor of class use injection. can check behaviour on structuremap documents.
so looking @ error looks missing mapping iuserstore<user>
userstore
class in structuremap.
if want structuremap use parameterless constructor, first need make sure structuremap creating accountcontroller
instance. need update structuremap registry code specify constructor should used. (see similar question here). explained in the documentation
Comments
Post a Comment