Question

Got this error while trying to get this Azure Autoscale demo project with WASABi from the Enterprise Library 5.0 Integration Pack for Windows Azure working. Error thrown when all instructions followed correctly is:

Activation error occured while trying to get instance of type Autoscaler, key "" at Microsoft.Practices.ServiceLocation.ServiceLocatorImplBase.GetInstance(Typ e serviceType, String key) in c:\Home\Chris\Projects\CommonServiceLocator\main\M icrosoft.Practices.ServiceLocation\ServiceLocatorImplBase.cs:line 57
at Microsoft.Practices.ServiceLocation.ServiceLocatorImplBase.GetInstanceTSe rvice in c:\Home\Chris\Projects\CommonServiceLocator\main\Microsoft.Practices .ServiceLocation\ServiceLocatorImplBase.cs:line 90 at PB_WASABi_autoscaler.Program.Main(String[] args) in c:\Users\daniel\Documents\Visual Studio 2012\Projects\PB-WASABi-autoscaler\PB-WASABi-autoscaler\Progr am.cs:line 13

Windows Azure 1.7 libraries are used.

Was it helpful?

Solution

Tutorial (and other online sources) mostly use Azure 1.6 SDK.

It works when in the console application there is a reference to WindowsAzure.StorageClient.dll file from Azure SDK 1.6. Under Azure SDK 1.7 environment there is this error message: Activation error occured while trying to get instance of type Autoscaler, key "". In the error details we find: 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).

Solution:

A binding redirect in your app.config file will solve the issue:

  <runtime>
    <assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1">
      <dependentAssembly>
        <assemblyIdentity name="Microsoft.WindowsAzure.StorageClient"
                          publicKeyToken="31bf3856ad364e35"
                          culture="neutral" />
        <bindingRedirect oldVersion="1.1.0.0"
                         newVersion="1.7.0.0"/>
      </dependentAssembly>
    </assemblyBinding>
  </runtime>

Source: here

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top