Activation error occured while trying to get instance of type Autoscaler, key "" with Azure SDK 2.0

Topics: Autoscaling Application Block ("Wasabi")
Jun 7, 2013 at 12:07 PM
Edited Jun 7, 2013 at 12:10 PM
I am trying WASABi autoscaling sample and facing this issue. I followed other threads on this error and tried using suggested runtime setting, but no luck. I am using Azure sdk 2.0.

------ERROR---------------------------------------------------------------------------
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 53
at Microsoft.Practices.ServiceLocation.ServiceLocatorImplBase.GetInstanceTSe rvice in c:\Home\Chris\Projects\CommonServiceLocator\main\Microsoft.Practices
.ServiceLocation\ServiceLocatorImplBase.cs:line 90
at ConsoleAutoscalar.Program.Main(String[] args) in D:\MyProjects\Working\Con

soleAutoscalar\ConsoleAutoscalar\Program.cs:line 16


class Program
{
    static void Main(string[] args)
    {
        try 
        {
            var scalar = EnterpriseLibraryContainer.Current.GetInstance<Autoscaler>();
            scalar.Start();

            while (true)
            {
                System.Threading.Thread.Sleep(10000);
                Console.WriteLine("{0} - running..." + DateTime.Now.ToString());
            }
        }
        catch(Exception ex)
        {
            Console.WriteLine(ex.Message + Environment.NewLine + ex.StackTrace);
        }

        Console.ReadKey();
    }

}

<?xml version="1.0" encoding="utf-8" ?>
<serviceModel xmlns="http://schemas.microsoft.com/practices/2011/entlib/autoscaling/serviceModel">
<subscriptions>
    <subscription name="YYYYYYY1"
                  subscriptionId="XXXXX1"
                  certificateThumbprint="222287DDC1BFD32192302B19DF962CF756CE3BD6"
                  certificateStoreName="My"
                  certificateStoreLocation="CurrentUser">
        <services>
            <service dnsPrefix="calsoftdev" slot="Production" scalingMode="Scale">
                <roles>
                    <role alias="MvcWebRole1"
                          roleName="MvcWebRole1"
                          wadStorageAccountName="calsoftdev"/>
                </roles>
            </service>
        </services>
        <storageAccounts>
            <storageAccount alias="calsoftdev"
        connectionString="DefaultEndpointsProtocol=https;AccountName=calsoftdev;AccountKey=9999999999STyjYb9yUX2IVmcJB2O3L/dnrngWTHXewDs5gPoD6BJeRgnE6WIi3Ry7ZjGGBb9Ut5IXS3lQGljg==">
                <queues>
                    <queue alias="workerqueue" queueName="workerqueue" />
                </queues>
            </storageAccount>
        </storageAccounts>
    </subscription>
</subscriptions>
<stabilizer scaleUpCooldown="00:01:00"
        scaleDownCooldown="00:01:00"
        scaleUpOnlyInFirstMinutesOfHour="0"
        scaleDownOnlyInLastMinutesOfHour="0" />

</serviceModel>

<?xml version="1.0" encoding="utf-8" ?>
<rules xmlns="http://schemas.microsoft.com/practices/2011/entlib/autoscaling/rules" enabled="true">
<constraintRules>

    <rule name="Default" enabled="true" rank="1">
        <actions>
            <range target="MvcWebRole1" min="1" max="2" />
        </actions>          
    </rule>

</constraintRules>

<reactiveRules>

    <rule name="Heavy Load (Increase)" enabled="true">
        <actions>
            <scale target="MvcWebRole1" by="1" />
        </actions>
        <when>
            <greaterOrEqual operand="QueueLength_Avg_5m" than="5" />
        </when>
    </rule>

    <rule name="Heavy Load (Decrease)" enabled="true">
        <actions>
            <scale target="MvcWebRole1" by="-1" />
        </actions>
        <when>
            <less operand="QueueLength_Avg_5m" than="5" />
        </when>
    </rule>

</reactiveRules>

<operands>
    <queueLength alias="QueueLength_Avg_5m" aggregate="Average" queue="workerqueue" timespan="00:05:00" />
</operands>

</rules>

<?xml version="1.0"?>
<configuration>
<configSections>
<section name="autoscalingConfiguration" type="Microsoft.Practices.EnterpriseLibrary.WindowsAzure.Autoscaling.Configuration.AutoscalingSettings, Microsoft.Practices.EnterpriseLibrary.WindowsAzure.Autoscaling, Version=5.0.1118.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35" requirePermission="true" />
<section name="typeRegistrationProvidersConfiguration" type="Microsoft.Practices.EnterpriseLibrary.Common.Configuration.TypeRegistrationProvidersConfigurationSection, Microsoft.Practices.EnterpriseLibrary.Common, Version=5.0.505.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35" />
</configSections>
<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>
<autoscalingConfiguration dataPointsStoreAccount="DefaultEndpointsProtocol=https;AccountName=calsoftdev;AccountKey=99999999STyjYb9yUX2IVmcJB2O3L/dnrngWTHXewDs5gPoD6BJeRgnE6WIi3Ry7ZjGGBb9Ut5IXS3lQGljg=="
ruleEvaluationRate="00:01:00" loggerName="System Diagnostics Logger"
rulesStoreName="Local File Rules Store" serviceInformationStoreName="Local File Service Information Store">
<loggers>
    <add name="System Diagnostics Logger" type="Microsoft.Practices.EnterpriseLibrary.WindowsAzure.Autoscaling.Logging.SystemDiagnosticsLogger, Microsoft.Practices.EnterpriseLibrary.WindowsAzure.Autoscaling, Version=5.0.1118.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35" />
</loggers>
<rulesStores>
    <add name="Local File Rules Store" type="Microsoft.Practices.EnterpriseLibrary.WindowsAzure.Autoscaling.Rules.Configuration.LocalXmlFileRulesStore, Microsoft.Practices.EnterpriseLibrary.WindowsAzure.Autoscaling, Version=5.0.1118.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35"
        filename="local-rules-store.xml" certificateThumbprint="272287DDC1BFD32192302B19DF962CF756CE3BD6" />
</rulesStores>
<serviceInformationStores>
    <add name="Local File Service Information Store" type="Microsoft.Practices.EnterpriseLibrary.WindowsAzure.Autoscaling.ServiceModel.Configuration.LocalXmlFileServiceInformationStore, Microsoft.Practices.EnterpriseLibrary.WindowsAzure.Autoscaling, Version=5.0.1118.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35"
        filename="local-serviceinformation-store.xml" certificateThumbprint="272287DDC1BFD32192302B19DF962CF756CE3BD6" />
</serviceInformationStores>
<advancedOptions>
    <serviceManagementRequestTracker trackServiceManagementRequests="false" />
    <executionLease useBlobExecutionLease="false" />
</advancedOptions>
</autoscalingConfiguration>
<typeRegistrationProvidersConfiguration>
<clear />
<add name="Caching" sectionName="cachingConfiguration" />
<add name="Cryptography" sectionName="securityCryptographyConfiguration" />
<add name="Exception Handling" sectionName="exceptionHandling" />
<add name="Instrumentation" sectionName="instrumentationConfiguration" />
<add name="Logging" sectionName="loggingConfiguration" />
<add name="Policy Injection" sectionName="policyInjection" />
<add name="Security" sectionName="securityConfiguration" />
<add name="Data Access" providerType="Microsoft.Practices.EnterpriseLibrary.Data.Configuration.DatabaseSyntheticConfigSettings, Microsoft.Practices.EnterpriseLibrary.Data" />
<add name="Validation" providerType="Microsoft.Practices.EnterpriseLibrary.Validation.Configuration.ValidationTypeRegistrationProvider, Microsoft.Practices.EnterpriseLibrary.Validation" />
<add sectionName="autoscalingConfiguration" name="autoscalingConfiguration" />
</typeRegistrationProvidersConfiguration>
<startup><supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.0"/></startup>
<system.diagnostics>
    <trace autoflush="true"></trace>
    <sources>
        <source name="Autoscaling General"
        switchName="SourceSwitch"
        switchType="System.Diagnostics.SourceSwitch" >
            <listeners>
                <add name="console" />
                <add name="file" />
                <remove name="Default"  />
            </listeners>
        </source>
        <source name="Autoscaling Updates"
 switchName="SourceSwitch"
 switchType="System.Diagnostics.SourceSwitch" >
            <listeners>
                <add name="console" />
                <add name="file" />
                <remove name="Default" />
            </listeners>
        </source>
    </sources>
    <sharedListeners>
        <add name="console" type="System.Diagnostics.ConsoleTraceListener">
            <filter type="System.Diagnostics.EventTypeFilter" initializeData="Verbose"/>
        </add>
        <add name="file" type="System.Diagnostics.TextWriterTraceListener" initializeData="C:\Logs\ConsoleAutoscaler.log">
            <filter type="System.Diagnostics.EventTypeFilter" initializeData="Verbose"/>
        </add>
    </sharedListeners>
    <switches>
        <add name="SourceSwitch"
value="Verbose, Information, Warning, Error, Critical" />
    </switches>

</system.diagnostics>

</configuration>

Jun 10, 2013 at 2:27 PM
The exception could mean that the configuration is not correct. Is the app.config deployed (as "<appname>.exe.config) along with the rules (local-rules-store.xml) and the services (local-serviceinformation-store.xml) to the console application output directory?

It might help to provide a simple console app that reproduces the issue.

~~
Randy Levy
entlib.support@live.com
Enterprise Library support engineer
Support How-to
Jun 11, 2013 at 6:10 AM
Yes, all mentioned files are in output debug dir. Sent an email to entlib.support@live.com [from mahesh.jasti@calsoftlabs.com] with attached application code.
Jun 11, 2013 at 6:18 AM
Please find related console app here
Jun 11, 2013 at 4:20 PM
Thanks for providing the sample. You will need to reference Microsoft.WindowsAzure.StorageClient v1.7.0.0. The Autoscaling Application Block has a dependency on this assembly. A breaking change was introduced in version 2 of the SDK -- the Microsoft.WindowsAzure.StorageClient namespace and assembly name were changed to Microsoft.WindowsAzure.Storage.

You should be able to run Microsoft.WindowsAzure.StorageClient v1.7.0.0 side by side with the new Microsoft.WindowsAzure.Storage v2.0.0.0.

~~
Randy Levy
entlib.support@live.com
Enterprise Library support engineer
Support How-to
Jun 12, 2013 at 7:34 AM
Thanks Randy... It worked with V1.7.0.0.

Are there any release plans to handle Azure 2.0 SDK ?
Dec 13, 2013 at 3:48 PM
Randy, I am interested also on whether their are any release plans to handle Azure 2.0 SDK. This would help for newcomers along with current users to determine their own development paths. Maintaining multiple SDKs can be cumbersome.