none
Windows Azure Caching (Preview) not working...

    Question

  • I'm trying to get Azure Caching working witihn my Web Application without any luck.

    I've upgraded to Azure June 2012 and enabled the Cache Tab, added the Nuget package, etc.

     DataCacheFactory cacheFactory = new DataCacheFactory();
                DataCache cache = cacheFactory.GetDefaultCache();
               // DataCache cachee = new DataCache();
    
    This throws an exception

       {"Unrecognized element 'autoDiscover'.     with the web.config file.

    Web.config contains tihs bit :

    <dataCacheClients>
    		<tracing sinkType="DiagnosticSink" traceLevel="Error" />
    		<dataCacheClient name="default">
    			<autoDiscover isEnabled="true" identifier="CacheWorkerRole" />
    			<localCache isEnabled="true" sync="TimeoutBased" objectCount="10000" ttlValue="300" />
    		</dataCacheClient>
    	</dataCacheClients>

    However I was looking at the Azure Cache Example on MSDN which contains the same however I noticed the DataCache is called with just the following :

       DataCache cachee = new DataCache();

    This doesnt seem to work in my project. the definition of DataCache doesnt match :

    #region Assembly Microsoft.ApplicationServer.Caching.Client.dll, v2.0.50727
    // C:\Users\Administrator\Downloads\Windows Azure Caching (Preview) API and Performance Sample\C#\packages\Microsoft.WindowsAzure.Caching.1.7.0.0\lib\net35-full\Microsoft.ApplicationServer.Caching.Client.dll
    #endregion
    
    using System;
    using System.Collections;
    using System.Collections.Generic;
    using System.Reflection;
    using System.Threading;

    whereas my project definition is :

    #region Assembly Microsoft.ApplicationServer.Caching.Client.dll, v2.0.50727
    // C:\develop\Azure\packages\WindowsAzure.Caching.1.7.0.0\lib\net35-full\Microsoft.ApplicationServer.Caching.Client.dll
    #endregion
    
    using System;
    using System.Collections;
    using System.Collections.Generic;
    using System.Reflection;
    
    namespace Microsoft.ApplicationServer.Caching

    Any idea?

    Thursday, June 28, 2012 11:59 AM

Answers

  • Do you have AppFabric Server installed on the box where Windows Azure SDK 1.7 is installed, if so you would get into issues. 

    http://blog.elastacloud.com/2012/06/09/using-the-windows-azure-cache-preview-with-sdk-1-7/

    Attach the debugger, look at modules window and see from which location the following DLLs are loaded.

    Microsoft.ApplicationServer.Caching.Client.dll

    Microsoft.ApplicationServer.Caching.Core.dll 

    Make sure the following properties hold:

    Assembly File Version - 1.0.4655.0

    Assembly Version - 1.0.0.0

    Make sure that these DLLs are not in GAC by any chance.

    Thanks,

    Laxmi


    If my post answered your question(s), please "Mark/Propose this as answer". All postings are as-is and confer no rights.


    Thursday, June 28, 2012 3:23 PM

All replies

  • Do you have AppFabric Server installed on the box where Windows Azure SDK 1.7 is installed, if so you would get into issues. 

    http://blog.elastacloud.com/2012/06/09/using-the-windows-azure-cache-preview-with-sdk-1-7/

    Attach the debugger, look at modules window and see from which location the following DLLs are loaded.

    Microsoft.ApplicationServer.Caching.Client.dll

    Microsoft.ApplicationServer.Caching.Core.dll 

    Make sure the following properties hold:

    Assembly File Version - 1.0.4655.0

    Assembly Version - 1.0.0.0

    Make sure that these DLLs are not in GAC by any chance.

    Thanks,

    Laxmi


    If my post answered your question(s), please "Mark/Propose this as answer". All postings are as-is and confer no rights.


    Thursday, June 28, 2012 3:23 PM
  • Hmmmm....

    Something weird in the SDK installation gone wrong or packaged incorrectly.

    Basically had to reference the Assemblies in "C:\Program Files\Microsoft SDKs\Windows Azure\.NET SDK\2012-06\ref\CachingPreview".

    But there is also a  version in C:\Program Files\Microsoft SDKs\Windows Azure\.NET SDK\2012-06\ref


    Micatio Software Free IIS Azure Web Log App

    Friday, June 29, 2012 9:11 AM
  • Receiving this error now :

    ErrorCode<ERRCA0021>:SubStatus<ES0001>:Server collection cannot be empty.

    when calling this method:

    DataCacheFactorycacheFactory = newDataCacheFactory();

    Micatio Software Free IIS Azure Web Log App

    Friday, June 29, 2012 11:45 AM
  • This error is returned "ErrorCode<ERRCA0021>:SubStatus<ES0001>:Server collection cannot be empty" if the dataCacheClient name is incorrect, hence double check the Named Cache setting

    <dataCacheClient name="default">


    Micatio Software Free IIS Azure Web Log App


    Saturday, June 30, 2012 5:25 AM
  • The one in C:\Program Files\Microsoft SDKs\Windows Azure\.NET SDK\2012-06\ref are for 'Windows Azure Shared Caching'

    The bits in C:\Program Files\Microsoft SDKs\Windows Azure\.NET SDK\2012-06\ref\CachingPreview are "Windows Azure Caching (Preview)" which is in-role caching.

    To enable caching as part of your deployment itself, use the bits from CachingPreview folder

    Monday, July 02, 2012 10:46 AM
  • I've checked that I am indeed referencing the .dlls correctly (all 5 in CachingPreview folder).  I get exactly the same error message when I try to start my web role that is using the distributed cache (co-located) for session state.  I'm using "default" for the name, and I have double checked that my Role cache properties also has "default" for the name.  I still get this error.
    Thursday, July 05, 2012 4:39 PM
  • I`m happy to see, I`m not the only one with this problem!

    https://www.windowsazure.com/en-us/develop/net/how-to-guides/cache/

    Followed 3x times, step by step, but still get the same errors above.

    • Edited by AzureMtl Thursday, July 05, 2012 7:49 PM
    Thursday, July 05, 2012 7:46 PM
  • If you're getting the exact error as in this thread then could you please check Windows Server AppFabric was installed in your system ?

    It might have been GAC'ed in your system, so eventhough you're referencing dlls from CachingPreview - runtime picks up from GAC which are older resulting in this issue.

    Please uninstall any server caching dlls in your system and then try again and post your experience.

    Thursday, July 05, 2012 8:04 PM
  • I do not have Windows Server AppFabric installed.  I do have Windows Azure SDK November 2011 and Windows Azure SDK June 2012 installed.
    Thursday, July 05, 2012 8:12 PM
  • Hi Simeon,

    Removing Caching from your solution and then re-add again.

    The error is to do with the framework not finding the Default Named Cache setting and/or datacacheclient setting correctly.

    Check that all project references are pointing to the correct versions, some maybe using the local copy hence revert back to the GAC version.

    Check that the web.config contains the following, note the identifier must match the web role name listed in your azure solution otherwise you will receive the same error as well.

    	<dataCacheClients>
    		<tracing sinkType="DiagnosticSink" traceLevel="Verbose" />
    		<dataCacheClient name="default">
    			<autoDiscover isEnabled="true" identifier="[YourWebRoleName]" />
    			<localCache isEnabled="true" sync="TimeoutBased" objectCount="10000" ttlValue="300" />
    		</dataCacheClient>
    	</dataCacheClients>



    Micatio Software Free IIS Azure Web Log App

    Thursday, July 05, 2012 9:57 PM
  • Hi Simeon,

        If Ron's suggestion didn't solve your issue, please try figuring out the file version of the modules Caching.Core.dll and Caching.Client.dll loaded during runtime of your app, by attaching a debugger to your running solution ( as suggested by Laxmi above ) and post your results.

    If it still didn't solve the issue, please compile your application once and pack the entire directory and share it with us. Will see if we can repro.

    Friday, July 06, 2012 6:06 AM
  • I also had the error:

    ErrorCode<ERRCA0021>:SubStatus<ES0001>:Server collection cannot be empty.

    I have my data layer in its own project. The config settings were in app.config. I managed to get it to work by adding the config settings to web.config in my web project which then gave an error of not finding the dlls. I added the dlls to the web project too and then it all worked.

    Should I have to add all of that to the web project too? It would be nice to just leave it in the data project.

    • Proposed as answer by KevinUK Sunday, July 15, 2012 7:13 PM
    • Unproposed as answer by Ron - Micatio Wednesday, September 05, 2012 8:44 PM
    Sunday, July 15, 2012 7:13 PM
  • For those getting assembly version mismatches from the GAC, make sure you are installing the Azure Caching PREVIEW package via NuGet, and not the "Azure Shared Caching" package.
    Wednesday, July 25, 2012 6:07 PM
  • First of all caching preview works on Azure Roles. You need to run on emulator and not stand alone web app in localhost. ( set the azure project as start up and run).

    I had been using storageclient before but the caching preview pulled out new dlls for storageclient and diagnostics even when it was not referenced.

    Felt like caching preview shipped old dlls(eg: 1.0.0.0 for caching core when sdk 1.6 had 101.0.0.0) but I was wrong. 

    Here is the fix which worked for me:

    http://azuretable.blogspot.nl/2012/09/azure-caching-preview-fix.html

    For  "ErrorCode<ERRCA0021>:SubStatus<ES0001>:Server collection cannot be empty", this is how I solved it:

    http://azuretable.blogspot.nl/2012/09/errorcode-substatus-server-collection.html

    PS: I did not have any anything to do with GAC or Windows Server AppFabric installation or removal














    • Edited by Blue Clouds Tuesday, September 11, 2012 9:16 AM
    Tuesday, September 04, 2012 6:45 PM
  • The one is the ref folder are the 'old' dlls used for shared caching model. The bits in 'CachingPreview' are the new dlls for the dedicated caching model ( in-role caching )

    If you use the 'Nuget' package to add the reference for the cache clients, then it'll reference the proper dlls and you should be good to go. If you're manually adding the reference, adding from the CachingPreview bits should solve the issue, provided that you no longer have Windows Server Appfabric installed.

    isEnabled attribute of <autoDiscover> needs to be true, otherwise client won't be able to find the cache server role.

    Wednesday, September 05, 2012 4:16 AM
  • I ran Nuget and the 101.0.0.0 dlls (core and client) were changed to 1.0.0.0 .

    And becuase of the new dlls I had to change Microsoft.WindowsAzure.Diagnostics.dll and Microsoft.WindowsAzure.StorageClient.dll from 1.7.0.0(ref) to 1.1.0.0. is 1.1.0.0 latest than 1.7.0.0?

    or are they not related(caching dlls and diagnostics)?

    And <autoDiscover> isEnabled was false in my webconfig and I changed it to true to make it work. thanks for pointing out and I have changed the blog.





    • Edited by Blue Clouds Tuesday, September 11, 2012 9:17 AM
    Wednesday, September 05, 2012 8:07 AM
  • The blog information about changing isEnabled to false should work for dedicated cache is not correct.

    Could you explain your scenario here ? Are you trying dedicated cache model ? Setting isEnabled to false actually breaks the client in finding the servers.

    Wednesday, September 05, 2012 11:33 AM
  • yes, isEnabled to false breaks the client . Like I said, it was a typo in the blog. isEnabled was 'false' and I changed it to true to make it work. I am trying caching preview itself. This is what is in my config now:

      <dataCacheClients>
          <dataCacheClient name="default">
            <autoDiscover isEnabled="true" identifier="webRoleName" />
          </dataCacheClient>
      </dataCacheClients>

    The blog is corrected. Thank you.



    • Edited by Blue Clouds Wednesday, September 05, 2012 12:41 PM
    Wednesday, September 05, 2012 12:32 PM
  • May I know what you would think about the dll mismatch I mentioned?
    Wednesday, September 05, 2012 12:58 PM
  • Hi All,

    The solution is within this thread hence no point going over old ground.


    Micatio Software Free IIS Azure Web Log App

    Wednesday, September 05, 2012 8:43 PM
  • I found out that 1.7.0.0 of Diagnostics and storageclient is used by caching preview. We could still make 1.1.0.0 work(worst case) with assembly redirect if we want.

    complete solution

    http://azuretable.blogspot.nl/2012/09/azure-caching-preview-fix.html

    Tuesday, September 11, 2012 9:19 AM