WebMethodAttribute Constructors
Definition
Important
Some information relates to prerelease product that may be substantially modified before it’s released. Microsoft makes no warranties, express or implied, with respect to the information provided here.
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, Int32) |
Initializes a new instance of the WebMethodAttribute class. |
WebMethodAttribute(Boolean, TransactionOption, Int32, Boolean) |
Initializes a new instance of the WebMethodAttribute class. |
WebMethodAttribute()
Initializes a new instance of the WebMethodAttribute class.
public:
WebMethodAttribute();
public WebMethodAttribute ();
Public Sub New ()
See also
Applies to
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.
Applies to
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
Public Sub New (enableSession As Boolean, transactionOption As TransactionOption)
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)]
Applies to
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
Public Sub New (enableSession As Boolean, transactionOption As TransactionOption, cacheDuration As Integer)
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)]
Applies to
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
Public Sub New (enableSession As Boolean, transactionOption As TransactionOption, cacheDuration As Integer, bufferResponse As Boolean)
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)]
Applies to
.NET