Custom Configuration Provider for Appfabric Caching

Released 7 years ago , Last update 7 years ago

This solution provides a custom configuration provider for appfabric caching based on amazon S3. This fixes the problem of the configuration file single-point-of-failure for appfabric.

By default, AppFabric caching provides two configuration stores: a SQL server store and an XML file store. These two options defeat the purpose of the distributed caching mechanism which is to avoid a single point of failure.

This solution provides and demonstration of a custom configuration provider for AppFabric caching that avoids the single point of failure problem by using S3 to give greater uptime.

You can create your own datastore by implementing the IDataStoreProxy interface and injecting the new implementation into the TransactionContext. Look at the existing AmazonProxy for guidance.

The solution contains 4 projects

  • A WinForms executable project that creates the UI for the custom configuration provider to be used by the AppFabric wizard
  • A library which contains the custom implementation of ICustomProvider which uses Amazon S3 as the configuration store (as opposed to a SQL database or a shared folder)
  • A test project with some very light tests
  • A deployment project which will set up all of the registry keys necessary and place the executable and library into the appropriate folders.

Please see the content pages for installation instructions


14 day 14-day money-back guarantee


Apache License, 2.0

The Apache License, 2.0 is an open-source license.

Installation Instructions


  • You must have AppFabric Server installed with the Caching package. You can download the installer here
  • You must follow the instructions here to set up the source code before you build.
  • You must have an Amazon S3 account and your credentials available. If you do not have an S3 account you can sign up here.

NOTE: All screenshots are from a Windows Server 2008 install. Depending on your OS the images may vary.


  1. After configuring the solution to fit your current enviroment, build the solution.
  2. In the Release/ folder, there should be an installer package called "S3ConfigurationDeployment.msi." Run this program which will configure the registry settings as needed and place the executable and assembly in the proper folder

  3. Run the AppFabric configuration wizard.


  4. When you get to the Caching Host Configuration step, select the provider from the dropdown list called "Amazon S3 Configuration Provider."

  5. Press the "Configure..." button. The custom UI appears. Enter your amazon credentials you would like to use.

  6. Continue through the end of the configuration wizard.
  7. Your custom provider awaits!

Source Code Configuration

You must do the following before building the solution.

  • Ensure that the build type is set to "Release" and that the platform is set to the architecture of the machine that you are deploying the solution to (x86 or x64). If you do not set this the solution will fail to operate.
  • You must insure that the installation paths in the deployment project are correct. Specifically the location of the AppFabric program folder. If you followed the defaults when installing AppFabric these should be okay.
  • You must ensure that the "Microsoft.ApplicationServer.Caching.Core" assembly referenced in the project matches the version of the currently installed AppFabric core assembly. The version in the solution is If the current version differs, simply add your local assembly as a reference instead of the dll contained in the source download. 


To "roll your own" storage provider, you must do three things:

  1. Create a custom implementation of the IStorageProxy interface and inject it into the transaction context. The implementation is fairly straightforward.

    public interface IStorageProxy : IDisposable { bool BuildUp(); bool TearDown(); bool PutObject(object o); object GetObject(); bool RemoveObject(); }

To inject it into the context, edit the below in the BeginTransaction() method and replace the S3Proxy with your own. I opted not to use unity (or any other DI container) because this was the only point of entry for injection.

//dependency injection for the storage client
                MyTransactionContext = new TransactionContext(
                    new AmazonS3Proxy(
                        new AmazonCredentials(
  1. Create your own ConfigurationUI.exe. Follow the AppFabricS3ConfigurationInterface for guidance. The key here is that you have a single connection string that is passed to the Open() method in the ICustomProvider interface. You must be able to format your connection credentials as a single string. Then call the PowerShellHelper as below to pass your connection credentials string to the SetConnectionString powershell command.


using (PowerShell shell = PowerShellHelper.GetPowerShellHost())
          shell.AddParameter("Provider", "YOURPROVIDERNAMEHERE");
          shell.AddParameter("ConnectionString", "YOURCONNECTIONSTRINGHERE");
  1. Edit the registry settings and deployment in the installation project accordingly. There are three registry keys to edit and at least two files to install (the custom provider and the UI for configuration). The registry keys are explained here. Remember to name the "root" key inside the provider key the same as the "YOURPROVIDERNAME" set in the powershell command for (2).
License » Apache License, 2.0 Download

Get A Quote

What do you need?
  • Custom development
  • Integration
  • Customization / Reskinning
  • Consultation
When do you need it?
  • Soon
  • Next week
  • Next month
  • Anytime

Thanks for getting in touch!

Your quote details have been received and we'll get back to you soon.

Or enter your name and Email
  • RS Rohit Shrivastava 4 years ago
    Do you think that writing production ready AppFabric Custom Provider would be feasible? I mean to say AppFabric is ready to configure custom provider and it has no issue in itself?
  • FL Fred Leefarr 7 years ago
    I've downloaded the source, built a Release, but the msi doesn't create the output dlls or registery entries. Perhaps I'm missing something?
    • LD Luke Doolittle Publisher 7 years ago
      Sorry for the delayed reply. I actually forgot about this account! I'm gonna look into it. But if you could, try running the msi with elevated permissions. I think in Win 7 to create the registry entries and to put the dlls in the correct folder requires admin access or uac approval. If not and you need a quick hack you can just build the dlls and manually add the reg entries present in the installer project.
    • FL Fred Leefarr 7 years ago
      Hi Luke, I ended up modifying the msi to register the dlls in the GAC, and made some progress. I could see that the AppFabric configuration xml was getting stored in S3, but as soon as I tried to start appfabric using powershell I was getting a null object reference error. In the end I opted for Membase, which hopefully should be a good fit for EC2. [Edit] Casting my mind back, the msi *was* creating the dlls and registry entries. I couldn't find them because they were being placed in a 'WOW64' directory. Many thanks, Fred.
    • LD Luke Doolittle Publisher 7 years ago
      Huh that is weird. Oh well. Ironically I made this because I was having some problems with Membase but I ended up going back to it myself.