Issue:
When implementing Autoscaling Application block(WASABi) by following the steps from below Microsoft link,
http://www.windowsazure.com/en-us/develop/net/how-to-guides/autoscaling/
you might face the error something like this.
Microsoft.Practices.ServiceLocation.ActivationException was unhandled
HResult=-2146233088
Message=Activation error occured while trying to get instance of type Autoscaler, key ""
Source=Microsoft.Practices.ServiceLocation
StackTrace:
at Microsoft.Practices.ServiceLocation.ServiceLocatorImplBase.GetInstance(Type serviceType, String key) in c:\Home\Chris\Projects\CommonServiceLocator\main\Microsoft.Practices.ServiceLocation\ServiceLocatorImplBase.cs:line 57
at Microsoft.Practices.ServiceLocation.ServiceLocatorImplBase.GetInstance[TService]() in c:\Home\Chris\Projects\CommonServiceLocator\main\Microsoft.Practices.ServiceLocation\ServiceLocatorImplBase.cs:line 90
at AutoScallingHost.Program.Main(String[] args) in Program.cs:line 14
at System.AppDomain._nExecuteAssembly(RuntimeAssembly assembly, String[] args)
at Microsoft.VisualStudio.HostingProcess.HostProc.RunUsersAssembly()
at System.Threading.ExecutionContext.RunInternal(ExecutionContext executionContext, ContextCallback callback, Object state, Boolean preserveSyncCtx)
at System.Threading.ExecutionContext.Run(ExecutionContext executionContext, ContextCallback callback, Object state, Boolean preserveSyncCtx)
at System.Threading.ExecutionContext.Run(ExecutionContext executionContext, ContextCallback callback, Object state)
at System.Threading.ThreadHelper.ThreadStart()
InnerException: Microsoft.Practices.Unity.ResolutionFailedException
HResult=-2146233088
Message=Resolution of the dependency failed, type = "Microsoft.Practices.EnterpriseLibrary.WindowsAzure.Autoscaling.Autoscaler", name = "(none)".
Exception occurred while: Calling constructor Microsoft.Practices.EnterpriseLibrary.WindowsAzure.Autoscaling.Autoscaler(System.String dataPointsStoreStorageAccountConnectionString, System.String dataPointsTableName, System.TimeSpan ruleEvaluationRate, Microsoft.Practices.EnterpriseLibrary.WindowsAzure.Autoscaling.Rules.IRulesStore rulesStore, Microsoft.Practices.EnterpriseLibrary.WindowsAzure.Autoscaling.ServiceModel.IServiceInformationStore serviceInformationStore, Microsoft.Practices.EnterpriseLibrary.WindowsAzure.Autoscaling.DataPointsCollection.IDataPointsCollectorsProvider dataPointsCollectorsProvider, Microsoft.Practices.EnterpriseLibrary.WindowsAzure.Autoscaling.IExecutionLease executionLease, Microsoft.Practices.EnterpriseLibrary.WindowsAzure.Autoscaling.Logging.ILogger logger, Microsoft.Practices.EnterpriseLibrary.WindowsAzure.Autoscaling.Scaling.IServiceManagementRequestTracker tracker, Microsoft.Practices.EnterpriseLibrary.WindowsAzure.Autoscaling.Scaling.IScaler scaler).
Exception is: FileLoadException - Could not load file or assembly 'Microsoft.WindowsAzure.StorageClient, Version=1.1.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35' or one of its dependencies. The located assembly's manifest definition does not match the assembly reference. (Exception from HRESULT: 0x80131040)
The reason for the above exception is, the two depedent assemblies "Microsoft.WindowsAzure.StorageClient" and "Microsoft.WindowsAzure.ServiceRuntime", looking for their old version of assembly.
To resolve that, you have to map dlls to old verison, by adding the below configuration in app.config file.
When implementing Autoscaling Application block(WASABi) by following the steps from below Microsoft link,
http://www.windowsazure.com/en-us/develop/net/how-to-guides/autoscaling/
you might face the error something like this.
Microsoft.Practices.ServiceLocation.ActivationException was unhandled
HResult=-2146233088
Message=Activation error occured while trying to get instance of type Autoscaler, key ""
Source=Microsoft.Practices.ServiceLocation
StackTrace:
at Microsoft.Practices.ServiceLocation.ServiceLocatorImplBase.GetInstance(Type serviceType, String key) in c:\Home\Chris\Projects\CommonServiceLocator\main\Microsoft.Practices.ServiceLocation\ServiceLocatorImplBase.cs:line 57
at Microsoft.Practices.ServiceLocation.ServiceLocatorImplBase.GetInstance[TService]() in c:\Home\Chris\Projects\CommonServiceLocator\main\Microsoft.Practices.ServiceLocation\ServiceLocatorImplBase.cs:line 90
at AutoScallingHost.Program.Main(String[] args) in Program.cs:line 14
at System.AppDomain._nExecuteAssembly(RuntimeAssembly assembly, String[] args)
at Microsoft.VisualStudio.HostingProcess.HostProc.RunUsersAssembly()
at System.Threading.ExecutionContext.RunInternal(ExecutionContext executionContext, ContextCallback callback, Object state, Boolean preserveSyncCtx)
at System.Threading.ExecutionContext.Run(ExecutionContext executionContext, ContextCallback callback, Object state, Boolean preserveSyncCtx)
at System.Threading.ExecutionContext.Run(ExecutionContext executionContext, ContextCallback callback, Object state)
at System.Threading.ThreadHelper.ThreadStart()
InnerException: Microsoft.Practices.Unity.ResolutionFailedException
HResult=-2146233088
Message=Resolution of the dependency failed, type = "Microsoft.Practices.EnterpriseLibrary.WindowsAzure.Autoscaling.Autoscaler", name = "(none)".
Exception occurred while: Calling constructor Microsoft.Practices.EnterpriseLibrary.WindowsAzure.Autoscaling.Autoscaler(System.String dataPointsStoreStorageAccountConnectionString, System.String dataPointsTableName, System.TimeSpan ruleEvaluationRate, Microsoft.Practices.EnterpriseLibrary.WindowsAzure.Autoscaling.Rules.IRulesStore rulesStore, Microsoft.Practices.EnterpriseLibrary.WindowsAzure.Autoscaling.ServiceModel.IServiceInformationStore serviceInformationStore, Microsoft.Practices.EnterpriseLibrary.WindowsAzure.Autoscaling.DataPointsCollection.IDataPointsCollectorsProvider dataPointsCollectorsProvider, Microsoft.Practices.EnterpriseLibrary.WindowsAzure.Autoscaling.IExecutionLease executionLease, Microsoft.Practices.EnterpriseLibrary.WindowsAzure.Autoscaling.Logging.ILogger logger, Microsoft.Practices.EnterpriseLibrary.WindowsAzure.Autoscaling.Scaling.IServiceManagementRequestTracker tracker, Microsoft.Practices.EnterpriseLibrary.WindowsAzure.Autoscaling.Scaling.IScaler scaler).
Exception is: FileLoadException - Could not load file or assembly 'Microsoft.WindowsAzure.StorageClient, Version=1.1.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35' or one of its dependencies. The located assembly's manifest definition does not match the assembly reference. (Exception from HRESULT: 0x80131040)
The reason for the above exception is, the two depedent assemblies "Microsoft.WindowsAzure.StorageClient" and "Microsoft.WindowsAzure.ServiceRuntime", looking for their old version of assembly.