Warning: file_get_contents(/data/phpspider/zhask/data//catemap/1/ssh/2.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
C# 当应用程序池回收时,无法使用unity容器解析依赖关系_C#_Iis_Dependency Injection_Unity Container - Fatal编程技术网

C# 当应用程序池回收时,无法使用unity容器解析依赖关系

C# 当应用程序池回收时,无法使用unity容器解析依赖关系,c#,iis,dependency-injection,unity-container,C#,Iis,Dependency Injection,Unity Container,当应用程序池回收时,我面临一个无法解决的依赖性问题。 当我们再次回收时,它会正确解决。 我已经在下面的一些细节点写了日志 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 Reso

当应用程序池回收时,我面临一个无法解决的依赖性问题。 当我们再次回收时,它会正确解决。 我已经在下面的一些细节点写了日志

 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, MyApp.DataAccess.IDataAccess, 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, String name, 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, MyApp.DataAccess.IDataAccess, 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, Object existing, String name, IEnumerable`1 resolverOverrides)
下面是如何在unity配置中完成配置

 <typeAlias alias="IDataAccess" type="MyApp.DataAccess.IDataAccess, MyApp.DataAccess" />
 <typeAlias alias="DataAccess" type="MyApp.DataAccess.DataAccess, MyApp.DataAccess" />

这种行为时断时续。这很奇怪