Export (0) Print
Expand All
0 out of 1 rated this helpful - Rate this topic

WebMethodAttribute.TransactionOption Property

Indicates the transaction support of an XML Web service method.

Namespace:  System.Web.Services
Assembly:  System.Web.Services (in System.Web.Services.dll)
member TransactionOption : TransactionOption with get, set

Property Value

Type: System.EnterpriseServices.TransactionOption
The transaction support of an XML Web service method. The default is Disabled.

XML Web service methods can only participate as the root object in a transaction, due to the stateless nature of the HTTP protocol. XML Web service methods can invoke COM objects that participate in the same transaction as the XML Web service method, if the COM object is marked to run within a transaction in the Component Services administrative tool. If an XML Web service method with a TransactionOption property of Required or RequiresNew invokes another XML Web service method with a TransactionOption property of Required or RequiresNew, each XML Web service method participates in its own transaction, because an XML Web service method can only act as the root object in a transaction.

Item

Description

Disabled

Indicates that the XML Web service method does not run within the scope of a transaction. When a request is processed, the XML Web service method is executed without a transaction.

[WebMethod(TransactionOption= TransactionOption.Disabled)]

NotSupported

Indicates that the XML Web service method does not run within the scope of a transaction. When a request is processed, the XML Web service method is executed without a transaction.

[WebMethod(TransactionOption= TransactionOption.NotSupported)]

Supported

Indicates that the XML Web service method does not run within the scope of transactions. When a request is processed, the XML Web service is created without a transaction.

[WebMethod(TransactionOption= TransactionOption.Supported)]

Required

Indicates that the XML Web service method requires a transaction. Since XML Web service methods can only participate as the root object in a transaction, a new transaction will be created for the XML Web service method.

[WebMethod(TransactionOption= TransactionOption.Required)]

RequiresNew

Indicates that the XML Web service method requires a new transaction. When a request is processed, the XML Web service is created within a new transaction.

[WebMethod(TransactionOption= TransactionOption.RequiresNew)]

If an exception is thrown from or not caught by an XML Web service method, the transaction is automatically aborted. If no exceptions occur the transaction is automatically committed unless the method explicitly calls SetAbort.

The example below begins a new transaction when the Transfer method is called.

No code example is currently available or this language may not be supported.

.NET Framework

Supported in: 4.5.1, 4.5, 4, 3.5, 3.0, 2.0, 1.1, 1.0

.NET Framework Client Profile

Supported in: 4, 3.5 SP1

Windows Phone 8.1, Windows Phone 8, Windows 8.1, Windows Server 2012 R2, Windows 8, Windows Server 2012, Windows 7, Windows Vista SP2, Windows Server 2008 (Server Core Role not supported), Windows Server 2008 R2 (Server Core Role supported with SP1 or later; Itanium not supported)

The .NET Framework does not support all versions of every platform. For a list of the supported versions, see .NET Framework System Requirements.

Show:
© 2014 Microsoft. All rights reserved.