如何解决应用程序池回收时无法使用统一容器解决依赖关系
当应用程序池回收时,我面临一个无法解决的依赖项问题。 当我们再次回收时,它会正确解决。 我在下面的一些细节上写了日志,
The current type,MyApp.DataAccess.IDataAccess,is an interface and cannot be constructed. Are you missing a type mapping?\r
At the time of the exception,the container was:\r\n\r\n Resolving MyApp.DataAccess.IDataAccess,(none)\r\n","DBResponseId":0}
Microsoft.Practices.Unity.ResolutionFailedException
Resolution of the dependency failed,type = "MyApp.DataAccess.IDataAccess",name = "(none)".
Exception occurred while: while resolving.
Exception is: InvalidOperationException - The current type,is an interface and cannot be constructed. Are you missing a type mapping?
-----------------------------------------------
At the time of the exception,the container was:
Resolving MyApp.DataAccess.IDataAccess,(none)
at Microsoft.Practices.Unity.UnityContainer.DoBuildUp(Type t,Object existing,String name,IEnumerable`1 resolverOverrides)
at Microsoft.Practices.Unity.UnityContainer.Resolve(Type t,ResolverOverride[] resolverOverrides)
at Microsoft.Practices.Unity.UnityContainerExtensions.Resolve[T](IUnityContainer container,ResolverOverride[] overrides)
at MyApp.Services.ServiceHelper.GetSession(String token,Boolean updateLastRequestTime) in E:\Application\MyAlert\Web\MyAlertCloud-Dev\Services\Services\ServiceHelper.cs:line 154
at MyApp.ServiceFacade.BaseServiceFacade`1.ExecuteService[TRequest,TResponse](Func`3 serviceFunc,TRequest request) in E:\Application\MyAlert\Web\MyAlertCloud-Dev\Services\Facade\ServiceFacade\BaseServiceFacade.cs:line 164
------------------------------ INNER LEVEL 1------------------------------
System.InvalidOperationException
The current type,is an interface and cannot be constructed. Are you missing a type mapping?
at Microsoft.Practices.ObjectBuilder2.DynamicMethodConstructorStrategy.ThrowForAttemptingToConstructInterface(IBuilderContext context)
at BuildUp_MyApp.DataAccess.IDataAccess(IBuilderContext )
at Microsoft.Practices.ObjectBuilder2.BuildPlanStrategy.PreBuildUp(IBuilderContext context)
at Microsoft.Practices.ObjectBuilder2.StrategyChain.ExecuteBuildUp(IBuilderContext context)
at Microsoft.Practices.Unity.UnityContainer.DoBuildUp(Type t,IEnumerable`1 resolverOverrides)
这里是如何在统一配置中完成配置
<typeAlias alias="IDataAccess" type="MyApp.DataAccess.IDataAccess,MyApp.DataAccess" />
<typeAlias alias="DataAccess" type="MyApp.DataAccess.DataAccess,MyApp.DataAccess" />
行为是打开和关闭的。这很奇怪。
版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 dio@foxmail.com 举报,一经查实,本站将立刻删除。