Chapter 5. Configuring your service

This chapter covers

  • Understanding the service configuration file
  • Handling configuration at runtime
  • Handling non-application settings, based on configuration
  • Sharing configuration between Azure and non-Azure applications

In the previous chapter, we concentrated on how you define your role using the service definition file. We’ll now look at the second part of the service model picture: the service configuration file.

5.1. Working with the service configuration file

In chapter 4, we described how the service definition file (ServiceDefinition.csdef) describes your role and how it’s used by the Fabric Controller (FC) to effectively manage your role. You learned that if you need to change any of the settings in your service definition file, you also need to redeploy your role.

You can change some other settings without redeploying your role. You can even change some of your settings dynamically without restarting the role (surely not; because we develop on Microsoft products, we love a good restart). These dynamic settings are typically stored in the service configuration file (ServiceConfiguration.cscfg).

In the service configuration file, you can dynamically configure standard Windows Azure runtime settings (the number of role instances and the certificate thumbprint) and your own custom settings. Let’s see how you configure this information and how you can dynamically modify these settings at runtime.

5.2. Handling configuration at runtime

5.3. Configuring non-application settings

5.4. Developing a common code base

5.5. The RoleEnvironment class and callbacks

5.6. Summary