WebMethodAttribute Constructors

Definition

Initializes a new instance of the WebMethodAttribute class.

Overloads

WebMethodAttribute()

Initializes a new instance of the WebMethodAttribute class.

WebMethodAttribute(Boolean)

Initializes a new instance of the WebMethodAttribute class.

WebMethodAttribute(Boolean, TransactionOption)

Initializes a new instance of the WebMethodAttribute class.

WebMethodAttribute(Boolean, TransactionOption)
WebMethodAttribute(Boolean, TransactionOption, Int32)

Initializes a new instance of the WebMethodAttribute class.

WebMethodAttribute(Boolean, TransactionOption, Int32)
WebMethodAttribute(Boolean, TransactionOption, Int32, Boolean)

Initializes a new instance of the WebMethodAttribute class.

WebMethodAttribute(Boolean, TransactionOption, Int32, Boolean)

WebMethodAttribute()

Initializes a new instance of the WebMethodAttribute class.

public:
 WebMethodAttribute();
public WebMethodAttribute ();
Public Sub New ()

See also

WebMethodAttribute(Boolean)

Initializes a new instance of the WebMethodAttribute class.

public:
 WebMethodAttribute(bool enableSession);
public WebMethodAttribute (bool enableSession);
new System.Web.Services.WebMethodAttribute : bool -> System.Web.Services.WebMethodAttribute
Public Sub New (enableSession As Boolean)

Parameters

enableSession
Boolean

Initializes whether session state is enabled for the XML Web service method.

WebMethodAttribute(Boolean, TransactionOption)

Initializes a new instance of the WebMethodAttribute class.

public:
 WebMethodAttribute(bool enableSession, System::EnterpriseServices::TransactionOption transactionOption);
public WebMethodAttribute (bool enableSession, System.EnterpriseServices.TransactionOption transactionOption);
new System.Web.Services.WebMethodAttribute : bool * System.EnterpriseServices.TransactionOption -> System.Web.Services.WebMethodAttribute

Parameters

enableSession
Boolean

Initializes whether session state is enabled for the XML Web service method.

transactionOption
TransactionOption

Initializes the transaction support of an XML Web service method.

Remarks

A web service call can only be the root of a transaction, due to the stateless nature of the HTTP protocol. This means that the following two settings are equivalent, with each call creating a new transaction:

[WebMethod(TransactionOption = TransactionOption.Required)]  
[WebMethod(TransactionOption = TransactionOption.RequiresNew)]  

It also means that all the following settings are equivalent; meaning no transaction support:

[WebMethod] // TransactionOption.Disabled is the default  
[WebMethod(TransactionOption = TransactionOption.Disabled)]  
[WebMethod(TransactionOption = Transaction.NotSupported)]  
[WebMethod(TransactionOption = Transaction.Supported)]  

WebMethodAttribute(Boolean, TransactionOption)

public:
 WebMethodAttribute(bool enableSession, System::Web::Services::TransactionOption transactionOption);
public WebMethodAttribute (bool enableSession, System.Web.Services.TransactionOption transactionOption);
new System.Web.Services.WebMethodAttribute : bool * System.Web.Services.TransactionOption -> System.Web.Services.WebMethodAttribute

Parameters

enableSession
Boolean
transactionOption
TransactionOption

WebMethodAttribute(Boolean, TransactionOption, Int32)

Initializes a new instance of the WebMethodAttribute class.

public:
 WebMethodAttribute(bool enableSession, System::EnterpriseServices::TransactionOption transactionOption, int cacheDuration);
public WebMethodAttribute (bool enableSession, System.EnterpriseServices.TransactionOption transactionOption, int cacheDuration);
new System.Web.Services.WebMethodAttribute : bool * System.EnterpriseServices.TransactionOption * int -> System.Web.Services.WebMethodAttribute

Parameters

enableSession
Boolean

Initializes whether session state is enabled for the XML Web service method.

transactionOption
TransactionOption

Initializes the transaction support of an XML Web service method.

cacheDuration
Int32

Initializes the number of seconds the response is cached.

Remarks

A web service call can only be the root of a transaction, due to the stateless nature of the HTTP protocol. This means that the following two settings are equivalent, with each call creating a new transaction:

[WebMethod(TransactionOption = TransactionOption.Required)]  
[WebMethod(TransactionOption = TransactionOption.RequiresNew)]  

It also means that all the following settings are equivalent; meaning no transaction support:

[WebMethod] // TransactionOption.Disabled is the default  
[WebMethod(TransactionOption = TransactionOption.Disabled)]  
[WebMethod(TransactionOption = Transaction.NotSupported)]  
[WebMethod(TransactionOption = Transaction.Supported)]  

WebMethodAttribute(Boolean, TransactionOption, Int32)

public:
 WebMethodAttribute(bool enableSession, System::Web::Services::TransactionOption transactionOption, int cacheDuration);
public WebMethodAttribute (bool enableSession, System.Web.Services.TransactionOption transactionOption, int cacheDuration);
new System.Web.Services.WebMethodAttribute : bool * System.Web.Services.TransactionOption * int -> System.Web.Services.WebMethodAttribute

Parameters

enableSession
Boolean
transactionOption
TransactionOption
cacheDuration
Int32

WebMethodAttribute(Boolean, TransactionOption, Int32, Boolean)

Initializes a new instance of the WebMethodAttribute class.

public:
 WebMethodAttribute(bool enableSession, System::EnterpriseServices::TransactionOption transactionOption, int cacheDuration, bool bufferResponse);
public WebMethodAttribute (bool enableSession, System.EnterpriseServices.TransactionOption transactionOption, int cacheDuration, bool bufferResponse);
new System.Web.Services.WebMethodAttribute : bool * System.EnterpriseServices.TransactionOption * int * bool -> System.Web.Services.WebMethodAttribute

Parameters

enableSession
Boolean

Initializes whether session state is enabled for the XML Web service method.

transactionOption
TransactionOption

Initializes the transaction support of an XML Web service method.

cacheDuration
Int32

Initializes the number of seconds the response is cached.

bufferResponse
Boolean

Initializes whether the response for this request is buffered.

Remarks

A web service call can only be the root of a transaction, due to the stateless nature of the HTTP protocol. This means that the following two settings are equivalent, with each call creating a new transaction:

[WebMethod(TransactionOption = TransactionOption.Required)]  
[WebMethod(TransactionOption = TransactionOption.RequiresNew)]  

It also means that all the following settings are equivalent; meaning no transaction support:

[WebMethod] // TransactionOption.Disabled is the default  
[WebMethod(TransactionOption = TransactionOption.Disabled)]  
[WebMethod(TransactionOption = Transaction.NotSupported)]  
[WebMethod(TransactionOption = Transaction.Supported)]  

WebMethodAttribute(Boolean, TransactionOption, Int32, Boolean)

public:
 WebMethodAttribute(bool enableSession, System::Web::Services::TransactionOption transactionOption, int cacheDuration, bool bufferResponse);
public WebMethodAttribute (bool enableSession, System.Web.Services.TransactionOption transactionOption, int cacheDuration, bool bufferResponse);
new System.Web.Services.WebMethodAttribute : bool * System.Web.Services.TransactionOption * int * bool -> System.Web.Services.WebMethodAttribute

Parameters

enableSession
Boolean
transactionOption
TransactionOption
cacheDuration
Int32
bufferResponse
Boolean

Applies to