When application pool recycles, i am facing an issue with one of our dependency that fails to resolve. When we recycle again it resolves correctly. I have written log at some points details below,
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)
Here is how the configurations are done in unity config
<typeAlias alias="IDataAccess" type="MyApp.DataAccess.IDataAccess, MyApp.DataAccess" />
<typeAlias alias="DataAccess" type="MyApp.DataAccess.DataAccess, MyApp.DataAccess" />
The behaviour is on and off. Which is very strange.