【发布时间】:2023-03-13 06:52:01
【问题描述】:
我在 WCF 服务和 MVC 4 应用程序上使用 StructureMap,我已经在它们上配置了它,但是一旦我运行应用程序,我就会收到以下异常:
StructureMap 异常代码:202 未定义默认实例 插件家族 LookupsRepositories.Lookups.ILookupRepository`1[[JE.Domain.Lookups.Status, JE.Domain,版本=1.0.0.0,文化=中性,PublicKeyToken=null]], LookupsRepositories,版本=1.0.0.0,文化=中性, PublicKeyToken=null
LookupRepository是一个抽象类,一个泛型类,我是这样注册的:
For(typeof(ILookupRepository<>)).Use(typeof(LookupRepository<>));
For<ILookupUnitOfWork>().Use<LookupUnitOfWork>();
Scan(s =>
{
s.AssemblyContainingType(typeof(LookupRepository<>));
s.ConnectImplementationsToTypesClosing(typeof(ILookupRepository<>));
});
调用Global.asax中的注册表:
protected void Application_Start(object sender, EventArgs e)
{
ObjectFactory.Initialize(x => x.AddRegistry(new JedcoRegistry()));
}
我仍然得到了例外。知道为什么吗?
注意:StructureMap 版本 2.6.4.0
【问题讨论】:
标签: asp.net-mvc wcf asp.net-mvc-4 structuremap wcf-extensions