Saturday, May 21, 2011

ServiceConfiguration




Last week, spoke about ServiceDefinition file and now itz about ServiceConfiguration.csdef file. Letz ellaborate XML elements of this cloud configuration file.


The root element ServiceConfiguration has only one attribute, namely serviceName. The serviceName attribute is mandatory element in ServiceConfiguration file. If you omit this attribute, Visual Studio is going to complain about your XML during compilation. The name of the service must match the name of the service in the service definition.


ServiceConfiguration element can have only Role elements as children. Because the only role we have is ASP.NET Web role, we can see only one Role element. In case our project contained another role the Service Configuration file would reflect this fact.


Role element also has a single name attribute which is required. The name attribute represents the name of the service and must match the name of the service in the service definition defined in the WebRole element. The Role element can have three children elements: Instances, ConfigurationSettings and Certificates. In the attached snap, the number of cloud instance is makred as 1. Certificates are related to the security methodology followed in the related cloud app.


Looking at our ServiceConfiguration.cscfg file we can see that it contains ConfigurationSettings and Instances elements.

1 comment:

  1. Thanks for breaking down the ServiceConfiguration.cscfg file so clearly! I’ve struggled before with matching role names between the definition and configuration files, so this explanation makes it much easier to understand. I’m curious if you’ll cover best practices for managing multiple roles and instances in configuration files in future posts.

    ReplyDelete