DryIoc:启用 'throwIfUnresolved' 总是抛出异常
DryIoc: Enabling 'throwIfUnresolved' always throw an exception
我想知道遗漏(未注入)的依赖项的名称!
我使用这个扩展:
- DryIoc.dll v4.0.7
- DryIoc.WebApi.dll v4.0.0
- DryIoc.Web.dll v4.0.0
我尝试使用throwIfUnresolved参数来解决问题
像这样:
public static void Register(HttpConfiguration config)
{
var container = new Container().WithWebApi(config, throwIfUnresolved: type => true);
//...
}
但在那之后我总是得到这个异常,即使没有依赖!
DryIoc.ContainerException: 'Unable to resolve ModelMetadataProvider IsResolutionCall
from Container with ambient ScopeContext DryIoc.AsyncExecutionFlowScopeContext without Scope
Where no service registrations found
and no dynamic registrations found in 0 of Rules.DynamicServiceProviders
and nothing found in 0 of Rules.UnknownServiceResolvers'
使用这个:
public static void Register(HttpConfiguration config)
{
var container = new Container()
.WithWebApi(
config,
throwIfUnresolved: type => type.IsController());
//...
}
我想知道遗漏(未注入)的依赖项的名称!
我使用这个扩展:
- DryIoc.dll v4.0.7
- DryIoc.WebApi.dll v4.0.0
- DryIoc.Web.dll v4.0.0
我尝试使用throwIfUnresolved参数来解决问题
像这样:
public static void Register(HttpConfiguration config)
{
var container = new Container().WithWebApi(config, throwIfUnresolved: type => true);
//...
}
但在那之后我总是得到这个异常,即使没有依赖!
DryIoc.ContainerException: 'Unable to resolve ModelMetadataProvider IsResolutionCall from Container with ambient ScopeContext DryIoc.AsyncExecutionFlowScopeContext without Scope Where no service registrations found and no dynamic registrations found in 0 of Rules.DynamicServiceProviders and nothing found in 0 of Rules.UnknownServiceResolvers'
使用这个:
public static void Register(HttpConfiguration config)
{
var container = new Container()
.WithWebApi(
config,
throwIfUnresolved: type => type.IsController());
//...
}