0

Currently, I have my Azure Cache configuration

<dataCacheClients>
  <dataCacheClient name="default">
    ...

inside my Web.config of my Azure WebRole. I would like to be able to easily modify the Azure Cache settings after the cspkg package has been created, i.e. I would like to move the configuration into the cscfg file.

I don't think that's possible without hand-coding all the possible configuration options of Azure Caches (and then interpreting those options and setting the configuration programmatically in the DataCacheFactory). Am I overlooking something?

Evgeniy Berezovsky
  • 18,571
  • 13
  • 82
  • 156

2 Answers2

0

One walkarround is to rename your .cspkg file to .zip file. Then unzip the file and take a look to the files. You will find .cssx files (the larger files) representing each webrole / working role. rename to .zip and expand. Then you will find a "approot" folder. Your dlls, webconfig, etc are there. You can mess with the webconfig and zip+rename the way back.

It's not elegant at all, but sometimes is the best way to figure out what exactly are you publishing.

Jordi
  • 2,789
  • 1
  • 20
  • 35
  • That was our first try at the time as well, but it didn't work, because included in that file is a checksum, and when you try to run (or deploy, I forgot at what step exactly) the modified .cspkg file Azure won't let you. I didn't implement it in the end, but I believe we are now using the cmd line tools for (re)packaging provided by MS and do that as part of our build process. – Evgeniy Berezovsky Jul 23 '12 at 23:24
  • to be honest, I do that trick when I want to know exactly what am I deploying. I never tried to zip it again. Sorry it didn't help :( – Jordi Jul 24 '12 at 08:43
0

in webrole (RoleEntryPoint derived class) onstart, you could overwrite web.config caching part with the relevant settings from your .cscfg file

also add eventhandler to the environment changing (RoleEnvironment.Changing += RoleEnvironmentChanging;) with e.Cancel = true so that the webrole restarts when ever you change .cscfg @ the management portal

Aliaksei Kliuchnikau
  • 13,589
  • 4
  • 59
  • 72
Martin
  • 1
  • Well yes, you can add all the dataCacheClient options to the cscfg as key/value-pairs somehow and then parse them out and manually do whatever you want. I would like to avoid the manual part. – Evgeniy Berezovsky Feb 02 '12 at 08:30