Configuring Encoding Policy for a Service

The encoding policy lets you configure the message encoding to apply to all messages that the service receives and sends. You can select whether to encode messages as text or to encode them by using the Message Transmission Optimization Mechanism (MTOM). MTOM encoding is useful for messages that contain large binary data objects.

The encoding policy exposes several properties that let you configure different aspects of the messages that the service accepts. The following table lists the exposed properties and a description of their effect. Default values are included. The default values apply if a service has no explicit encoding policy defined.

Policy Properties

Description

encodingType

Specifies the encoding type applied to all messages. Possible values are Text and Mtom.

maxReceivedMessageSize

A positive integer that defines the maximum byte length of a single message. The default value is 65536.

maxArrayLength

A positive integer that defines the maximum allowed array length. The default value is 16384.

maxBytesPerRead

A positive integer that specifies the maximum number of bytes per read. The default value is 4096.

maxDepth

A positive integer that defines the maximum nested node depth per read. The default value is 32.

maxNameTableCharCount

A positive integer that defines the maximum number of characters allowed in a table name. The default value is 16384.

maxStringContentLength

A positive integer that defines the maximum number of characters allowed in an XML content element. the default value is 8192.

To add the encoding policy to a service

  1. In the DCS Management Services Console, expand Policy Management, expand the service to which you want to apply the policy, and then click Policies.
  2. In the left pane, right-click the Policies folder, and then click New.
  3. In the Edit Policy dialog box, in the Policy Type list, click Microsoft.ConnectedIndustry.ServiceModel.Applciation.Policy.EncodingPolicy.
  4. Configure the policy properties, and then click OK to save the properties and apply the policy to the service.

The following figure shows a sample encoding policy configuration in the DCS Management Services Console.

Dd632179.82a4e60d-465e-4567-bbde-5ff41a757a67(en-us,MSDN.10).png

A sample encoding policy configuration