次の方法で共有


WebServiceAttribute コンストラクタ

WebServiceAttribute クラスの新しいインスタンスを初期化します。

Public Sub New()
[C#]
public WebServiceAttribute();
[C++]
public: WebServiceAttribute();
[JScript]
public function WebServiceAttribute();

使用例

 
<%@ WebService Language="VB" class= "ServerVariables"%>
 
Imports System
Imports System.Web.Services
Imports System.Web.Services.Protocols

<WebService(Namespace := "https://www.contoso.com/")> _
Public Class ServerVariables
    Inherits WebService

    <WebMethod(Description := "Returns the time as stored on the Server", _
        EnableSession := False)> _
    Public Function Time() As String
        
        Return Context.Timestamp.TimeOfDay.ToString()
    End Function
End Class


[C#] 
<%@ WebService Language="C#" class= "ServerVariables"%>
 
 using System;
 using System.Web.Services;
 using System.Web.Services.Protocols;
 
 [ WebService(Namespace="https://www.contoso.com/")]
 public class ServerVariables: WebService {
    [ WebMethod(Description="Returns the time as stored on the Server",EnableSession=false)]
    public string Time() {
       return Context.Timestamp.TimeOfDay.ToString();
    }
 }
 

[C++, JScript] C++ および JScript のサンプルはありません。Visual Basic および C# のサンプルを表示するには、このページの左上隅にある言語のフィルタ ボタン 言語のフィルタ をクリックします。

必要条件

プラットフォーム: Windows 98, Windows NT 4.0, Windows Millennium Edition, Windows 2000, Windows XP Home Edition, Windows XP Professional, Windows Server 2003 ファミリ

参照

WebServiceAttribute クラス | WebServiceAttribute メンバ | System.Web.Services 名前空間