WebMethodAttribute 构造函数
定义
重要
一些信息与预发行产品相关,相应产品在发行之前可能会进行重大修改。 对于此处提供的信息,Microsoft 不作任何明示或暗示的担保。
初始化 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 service 方法启用会话状态。
适用于
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 service 方法启用会话状态。
- transactionOption
- TransactionOption
初始化 XML Web service 方法的事务支持。
注解
由于 HTTP 协议的无状态性质,Web 服务调用只能是事务的根。 这意味着以下两个设置是等效的,每次调用都创建新的事务:
[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)
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
Public Sub New (enableSession As Boolean, transactionOption As TransactionOption)
参数
- enableSession
- Boolean
- transactionOption
- TransactionOption
适用于
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 service 方法启用会话状态。
- transactionOption
- TransactionOption
初始化 XML Web service 方法的事务支持。
- cacheDuration
- Int32
初始化响应的缓存秒数。
注解
由于 HTTP 协议的无状态性质,Web 服务调用只能是事务的根。 这意味着以下两个设置是等效的,每次调用都创建新的事务:
[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)
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
Public Sub New (enableSession As Boolean, transactionOption As TransactionOption, cacheDuration As Integer)
参数
- enableSession
- Boolean
- transactionOption
- TransactionOption
- cacheDuration
- Int32
适用于
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 service 方法启用会话状态。
- transactionOption
- TransactionOption
初始化 XML Web service 方法的事务支持。
- cacheDuration
- Int32
初始化响应的缓存秒数。
- bufferResponse
- Boolean
初始化是否对此请求的响应进行缓冲处理。
注解
由于 HTTP 协议的无状态性质,Web 服务调用只能是事务的根。 这意味着以下两个设置是等效的,每次调用都创建新的事务:
[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)
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
Public Sub New (enableSession As Boolean, transactionOption As TransactionOption, cacheDuration As Integer, bufferResponse As Boolean)
参数
- enableSession
- Boolean
- transactionOption
- TransactionOption
- cacheDuration
- Int32
- bufferResponse
- Boolean