Service Definition Schema
[This is prerelease documentation and is subject to change in future releases.]

The service definition file defines the roles available to a service, specifies the service endpoints, and establishes configuration parameters for the service. Configuration parameter values are set in the service configuration file, as described by the Service Configuration File Schema.

The default extension for the service definition file is .csdef.

Sample Service Definition File

The following shows a sample service definition file for a service that includes a web role and a worker role. Note that a service may include any number of web and worker roles.

<?xml version="1.0" encoding="utf-8"?>
<ServiceDefinition xmlns ="http://schemas.microsoft.com/ServiceHosting/2008/10/ServiceDefinition" name="MyService">
  <WebRole name="MyWebRole">
    <LocalStorage name="WebRoleCache" sizeInMb="1"/>
    <ConfigurationSettings>
      <Setting name="ConfigSetting1"/>
      <Setting name="ConfigSetting2"/>
    </ConfigurationSettings>
    <InputEndpoints>
      <InputEndpoint name="HttpIn" port="80" protocol="http"/>
    </InputEndpoints>
  </WebRole>
  <WorkerRole name="WorkerRole" entrypoint=" MyService.EntryPoint.WorkerRole">
    <LocalStorage name="WorkerRoleCache" sizeInMb="1"/> 
  </WorkerRole>
 </ServiceDefinition>

Service Definition Namespace

The XML namespace for the service definition file is:

http://schemas.microsoft.com/ServiceHosting/2008/10/ServiceDefinition

Service Definition Schema Types

The following table describes the element types of the service definition file.

 

Element Description

ServiceDefinition Element

The top-level element of the service definition file.

LocalStorage Element (Service Definition Schema)

A local storage resource that provides caching space for the service.

WebRole Element (Service Definition Schema)

A role that accepts external requests via HTTP and/or HTTPS endpoints.

WorkerRole Element (Service Definition Schema)

A role that performs processing for the service.

Protocol Element (Service Definition Schema)

The transport protocol for a web role.

InputEndpoints Element (Service Definition Schema)

The collection of input endpoints.

InputEndpoint Element (Service Definition Schema)

A service endpoint, defined by the transport protocol and port on which the service receives requests.

ConfigurationSettings Element (Service Definition Schema)

The collection of configuration settings.

Setting Element (Service Definition Schema)

A name/value pair that specifies a configuration setting for an instance of a role. The setting is defined in the service definition file; the value for an instance is provided in the service settings file.

See Also

Page view tracker