WebMethodAttribute 建構函式
定義
重要
部分資訊涉及發行前產品,在發行之前可能會有大幅修改。 Microsoft 對此處提供的資訊,不做任何明確或隱含的瑕疵擔保。
初始化 WebMethodAttribute 類別的新執行個體。
多載
| 名稱 | Description |
|---|---|
| WebMethodAttribute() |
初始化 WebMethodAttribute 類別的新執行個體。 |
| WebMethodAttribute(Boolean) |
初始化 WebMethodAttribute 類別的新執行個體。 |
| WebMethodAttribute(Boolean, TransactionOption) |
初始化 WebMethodAttribute 類別的新執行個體。 |
| WebMethodAttribute(Boolean, TransactionOption, Int32) |
初始化 WebMethodAttribute 類別的新執行個體。 |
| WebMethodAttribute(Boolean, TransactionOption, Int32, Boolean) |
初始化 WebMethodAttribute 類別的新執行個體。 |
WebMethodAttribute()
初始化 WebMethodAttribute 類別的新執行個體。
public:
WebMethodAttribute();
public WebMethodAttribute();
Public Sub New ()
另請參閱
適用於
WebMethodAttribute(Boolean)
初始化 WebMethodAttribute 類別的新執行個體。
public:
WebMethodAttribute(bool enableSession);
public WebMethodAttribute(bool enableSession);
new System.Web.Services.WebMethodAttribute : bool -> System.Web.Services.WebMethodAttribute
Public Sub New (enableSession As Boolean)
參數
- enableSession
- Boolean
初始化是否啟用 XML Web 服務方法的會話狀態。
適用於
WebMethodAttribute(Boolean, TransactionOption)
初始化 WebMethodAttribute 類別的新執行個體。
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)
參數
- enableSession
- Boolean
初始化是否啟用 XML Web 服務方法的會話狀態。
- transactionOption
- TransactionOption
初始化 XML Web 服務方法的交易支援。
備註
由於 HTTP 協定的無狀態特性,網路服務呼叫只能是交易的根源。 這表示以下兩種設定是等價的,每個呼叫都會產生新的交易:
[WebMethod(TransactionOption = TransactionOption.Required)]
[WebMethod(TransactionOption = TransactionOption.RequiresNew)]
這也表示以下所有設定都是等價的;意指無法支援交易:
[WebMethod] // TransactionOption.Disabled is the default
[WebMethod(TransactionOption = TransactionOption.Disabled)]
[WebMethod(TransactionOption = Transaction.NotSupported)]
[WebMethod(TransactionOption = Transaction.Supported)]
適用於
WebMethodAttribute(Boolean, TransactionOption, Int32)
初始化 WebMethodAttribute 類別的新執行個體。
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)
參數
- enableSession
- Boolean
初始化是否啟用 XML Web 服務方法的會話狀態。
- transactionOption
- TransactionOption
初始化 XML Web 服務方法的交易支援。
- cacheDuration
- Int32
初始化回應快取的秒數。
備註
由於 HTTP 協定的無狀態特性,網路服務呼叫只能是交易的根源。 這表示以下兩種設定是等價的,每個呼叫都會產生新的交易:
[WebMethod(TransactionOption = TransactionOption.Required)]
[WebMethod(TransactionOption = TransactionOption.RequiresNew)]
這也表示以下所有設定都是等價的;意指無法支援交易:
[WebMethod] // TransactionOption.Disabled is the default
[WebMethod(TransactionOption = TransactionOption.Disabled)]
[WebMethod(TransactionOption = Transaction.NotSupported)]
[WebMethod(TransactionOption = Transaction.Supported)]
適用於
WebMethodAttribute(Boolean, TransactionOption, Int32, Boolean)
初始化 WebMethodAttribute 類別的新執行個體。
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)
參數
- enableSession
- Boolean
初始化是否啟用 XML Web 服務方法的會話狀態。
- transactionOption
- TransactionOption
初始化 XML Web 服務方法的交易支援。
- cacheDuration
- Int32
初始化回應快取的秒數。
- bufferResponse
- Boolean
初始化此請求的回應是否被緩衝。
備註
由於 HTTP 協定的無狀態特性,網路服務呼叫只能是交易的根源。 這表示以下兩種設定是等價的,每個呼叫都會產生新的交易:
[WebMethod(TransactionOption = TransactionOption.Required)]
[WebMethod(TransactionOption = TransactionOption.RequiresNew)]
這也表示以下所有設定都是等價的;意指無法支援交易:
[WebMethod] // TransactionOption.Disabled is the default
[WebMethod(TransactionOption = TransactionOption.Disabled)]
[WebMethod(TransactionOption = Transaction.NotSupported)]
[WebMethod(TransactionOption = Transaction.Supported)]