System.ServiceModel 4.0.0.0 System.Attribute System.ServiceModel.Description.IServiceBehavior System.AttributeUsage(System.AttributeTargets.Class)

Apply the attribute to a service implementation to specify service-wide execution behavior. (To specify execution behavior at the method level, use the attribute.) This attribute can be applied only to service implementations. For working examples, see the Service Behaviors Samples.

properties are a indigo1 programming model feature that enables common features that developers otherwise have to implement. For more information about these and other behaviors, see Specifying Runtime Behavior. For more information about the underlying runtime properties that some of the following properties set, see Extending ServiceHost and the Dispatcher.

The property specifies the type of filter that the dispatcher system uses to locate the endpoint that handles requests.

The property automatically closes the session when the channel is closed and the service has finished processing any remaining messages.

The property controls the internal threading model, enabling support for reentrant or multithreaded services.

The property is used to declare a name for use in the name attribute of the <service> element in a configuration file.

The property enables the run time to ignore extra serialization information that is not required to process the message.

The property specifies whether unhandled exceptions in a service are returned as SOAP faults. This is for debugging purposes only.

The property specifies whether and when services and their service objects are to be recycled during an exchange with a client.

The property to limit on the number of items in an object graph that are serialized.

The and properties control the name and namespace for the WSDL expression of the service element.

The property specifies whether the service object is recycled when a transaction completes.

The property specifies whether outstanding transactions are completed when the session closes.

The property specifies the transaction isolation level that the contract supports.

The property specifies the time period within which a transaction must complete or it aborts.

The property indicates whether to synchronize inbound method calls with the user interface thread automatically.

The property informs the system whether it should confirm that SOAP headers marked as MustUnderstand have, in fact, been understood.

The property can also be set using an application configuration file. For details, see .

Specifies the internal execution behavior of a service contract implementation.

- Constructor
  4.0.0.0

  The default values for the are:

  The is set to .

  The property is true.

  The is set to .

  The property is the namespace-qualified name of the type without the assembly information.

  The property is false.

  The property is set to 64KB.

  The property is the name of the service type, without namespace or assembly information.

  The property is "http://tempuri.org".

  The property is true.

  is false.

  is true.

  The property is false.

  The property is .

  The property is set to .

  The property is true.

  Initializes a new instance of the class.

- Property
  4.0.0.0
  System.ServiceModel.AddressFilterMode To be added. To be added.

  Gets or sets the that is used by the dispatcher to route incoming messages to the correct endpoint.

- Property
  4.0.0.0
  System.Boolean To be added.

  By default when a client closes an output session and the service has finished processing any remaining messages the server closes the session. Setting to false prevents the server from automatically closing the session and enables custom control of session lifetimes.

  Specifies whether to automatically close a session when a client closes an output session.

- Property
  4.0.0.0
  System.ServiceModel.ConcurrencyMode To be added.

  This property indicates whether an instance of a service can handle one thread or multiple threads that execute concurrently, and if single-threaded, whether reentrancy is supported.

  The property interacts with some other settings. For example, if the value is set to the result is that your service can only process one message at a time unless you also set the value to . This property also produces behavior in combination with the property. For details, see Sessions, Instancing, and Concurrency.

  Setting to instructs the system to restrict instances of the service to one thread of execution at a time, which frees you from dealing with threading issues. A value of means that service objects can be executed by multiple threads at any one time. In this case, you must ensure thread safety.

  also restricts access to a single thread at a time; while the operation is processing, no other message can enter the operation. If during the operation a call to another service leaves, the current message loses the lock on the operation, which is free to process other messages. When the service call out returns, the lock is reestablished and the original message can continue processing to its conclusion or until another call out of the operation occurs.

  It is your responsibility to leave your object state consistent before callouts and you must confirm that operation-local data is valid after callouts. Note that the service instance is unlocked only by calling another service over a indigo2 channel. In this case, the called service can reenter the first service via a callback. If the first service is not reentrant, the sequence of calls results in a deadlock. For details, see .

  During any outbound call from a processing operation, data not local to the operation can be modified. (Local state data is guaranteed to be valid when the original message resumes processing.) As a result, before your outbound call you must ensure that non-local data is valid for other incoming calls and revalidate non-local data after the outbound call returns.

  The following pseudo-code illustrates the required pattern for successful reentrant support.

  `public void MyMethod() { this.SomeNonLocalDataState; // Here you need to clean nonlocal state for other users OutboundProxy proxy = new OutboundProxy(); int returnValue = proxy.CallOutOfOperation(); // Ensure that this.SomeNonLocalDataState is valid for continued use. this.ModifyNonLocalState; return returnValue; }`

  Using the Begin/End asynchronous call pattern for an outbound call when the is triggers an exception. Asynchronous outbound calls require an operation in which is , in which case you must handle synchronization issues.

  Generally, if a message arrives for an instance that violates its concurrency mode, the message waits until the instance is available, or until it times out.

  In addition, if the is set to and a reentrant call is blocked while waiting for the instance to be freed, the system detects the deadlock and throws an exception.

  A is thrown at runtime if is true when the property is set to .

  Note that you must explicitly set to false if there is an operation with set to true and you set to . Otherwise a validation exception is thrown because the default value of is true.

  There is an interaction of the and other properties that can alter runtime behavior. For a complete description of these interactions, see Sessions, Instancing, and Concurrency.

  Gets or sets whether a service supports one thread, multiple threads, or reentrant calls.

- Property
  4.0.0.0
  System.String To be added.

  Use this value to specify a particular service in the configuration file.

  Gets or sets the value used to locate the service element in an application configuration file.

- Method
  4.0.0.0
  System.Object

  A non-null value provides the service instance to which all messages addressed to the service will be dispatched.

  Retrieves an object that implements the service and that is used as the singleton instance of the service, or null if there is no singleton instance.

  An implementation of the service. The default value is null.

- Property
  4.0.0.0
  System.Boolean To be added.

  If a type implements the interface, it stores any extra data it doesn’t know about that comes over the wire when deserializing into that type. For example, if a type Person has members FirstName and LastName, and an element called PhoneNumber comes in, it is stored. When later serializing the type, PhoneNumber will be re-emitted. The problem is that the schema for Person exported by that service only has FirstName and LastName, so indigo1 generates a schema-invalid instance! If strict schema compliance is important, you can set to true to turn this re-emitting behavior off.

  Regardless setting, indigo2 always processes known data (both in and out) and does not throw exceptions when extra data comes in. You can also set this property using the <dataContractSerializer> element in an application configuration file.

  Gets or sets a value that specifies whether to send unknown serialization data onto the wire.

- Property
  4.0.0.0
  System.Boolean To be added.

  Set to true to enable exception information to flow to clients for debugging purposes. This property requires a binding that supports either request-response or duplex messaging.

  In all managed applications, processing errors are represented by objects. In SOAP-based applications such as indigo2 applications, methods that implement service operations communicate error information using SOAP fault messages. Because indigo2 applications execute under both types of error systems, any managed exception information that needs to be sent to the client must be converted from exceptions into SOAP faults. For more information, see Specifying and Handling Faults in Contracts and Services.

  During development, you may want your service to also send other exceptions back to the client to assist you in debugging. This is a development-only feature and should not be employed in deployed services.

  To facilitate debugging development, set the to true either in code or using an application configuration file.

  When enabled, the service automatically returns safer exception information to the caller. These faults appear to the client as objects of type .

  Setting to true enables clients to obtain information about internal service method exceptions; it is only recommended as a way of temporarily debugging a service application. In addition, the WSDL for a method that returns unhandled managed exceptions in this way does not contain the contract for the of type . Clients must expect the possibility of an unknown SOAP fault to obtain the debugging information properly.

  Setting this property to true can also be done using an application configuration file and the <serviceDebug> element, as the following code example shows.

  code reference: OperationBehaviorAttribute1#10

  Gets or sets a value that specifies that general unhandled execution exceptions are to be converted into a of type and sent as a fault message. Set this to true only during development to troubleshoot a service.

- Property
  4.0.0.0
  System.ServiceModel.InstanceContextMode To be added.

  Use the property to specify when new service objects are created. Because the service object is not directly connected to the communicating channel, the lifetime of the service objects is independent of the lifetime of the channel between a client and the service application. The default value, , instructs the service application to create a new service object when a new communication session is established between a client and the service application. Subsequent calls in the same session are handled by the same object.

  indicates that each service object handles requests from one client channel.

  The property interacts with some other settings. For example, if the value is set to the result is that your service can only process one message at a time unless you also set the value to . This property also produces behavior in combination with the property. For details, see Sessions, Instancing, and Concurrency.

  For singleton lifetime behavior (for example, if the host application calls the constructor and passes an object to use as the service), the service class must set to Single, or an exception is thrown at run time.

  Gets or sets the value that indicates when new service objects are created.

- Property
  4.0.0.0
  System.Int32 To be added.

  Use the property set a limit on the number of items in an object graph that are serialized. You can also set this property using the <dataContractSerializer> element in an application configuration file.

  Gets or sets the maximum number of items allowed in a serialized object.

- Property
  4.0.0.0
  System.String To be added. To be added.

  Gets or sets the value of the name attribute in the service element in Web Services Description Language (WSDL).

- Property
  4.0.0.0
  System.String To be added. To be added.

  Gets or sets the value of the target namespace for the service in Web Services Description Language (WSDL).

- Property
  4.0.0.0
  System.Boolean To be added.

  Note that you must explicitly set to false if there is an operation with set to true and you set to . Otherwise a validation exception is thrown because the default value of is true.

  In addition, it is important to realize that if the service is created by passing a service object to the constructor, the value of this property is treated as if it were false.

  Gets or sets a value that specifies whether the service object is released when the current transaction completes.

- Method
  4.0.0.0
  System.Void ``

  This provides the service instance to which all messages addressed to the service will be dispatched.

  If is set to a non-null value, then the must be set to or an is thrown.

  Specifies an object that implements the service and that is used as the singleton instance of the service.

  The singleton instance of the service.
- Method
  4.0.0.0
  System.Void `` `` `` `` To be added.

  Passes custom data objects to the bindings that support the behavior properties.

  The service description. The service host. The service endpoints. The data objects needed by bindings to support the behavior.
- Method
  4.0.0.0
  System.Void `` `` To be added.

  Customizes the service run time to support the behavior properties.

  The service description. The service host.
- Method
  4.0.0.0
  System.Void `` `` To be added.

  Confirms that the service description and service host are capable of supporting the behavior.

  The service description. The service host.
- Property
  4.0.0.0
  System.Boolean To be added. To be added.

  Gets or sets a value that specifies whether pending transactions are completed when the current session closes without error.

- Property
  4.0.0.0
  System.Transactions.IsolationLevel To be added.

  The isolation level in which your transaction runs determines how data is treated when changes are made in other transactions and how long your transaction must hold locks to protect against these changes. For example, the default value, , specifies that no updating or inserting can occur until the transaction is complete.

  This property can also be used to restrict the isolation level of incoming transactions flowed from a client.

  Specifies the transaction isolation level for new transactions created inside the service, and incoming transactions flowed from a client.

- Property
  4.0.0.0
  System.String To be added.

  This value sets the property. You can also set this property using the <serviceTimeOuts> element in an application configuration file.

  Gets or sets the period within which a transaction must complete.

- Property
  4.0.0.0
  System.Boolean To be added.

  Use this property to provide the user interface thread affinity that some applications require. For example, a Windows Forms application may be registered as a singleton service object. In this case, all calls into the service must run on the Windows Forms thread. The default case, in which is set to true, synchronizes all calls to the service to run on the thread captured from the .

  Gets or sets a value that specifies whether to use the current synchronization context to choose the thread of execution.

- Property
  4.0.0.0
  System.Boolean To be added.

  Use the property to turn off the enforced validation of arriving message headers. In normal execution, message headers are compared against the property to confirm that arriving headers are explicitly handled by the service. Set this to false to disable this checking. When set to false, the application must check for headers marked with MustUnderstand="true" and return a fault if one or more of them were not understood. This is useful when the application is supposed to accept any incoming SOAP messages (for example, when using typed or untyped messages) and perform custom header processing.

  Gets or sets a value that specifies whether the system or the application enforces SOAP MustUnderstand header processing.