WebService.Server 屬性
定義
重要
部分資訊涉及發行前產品,在發行之前可能會有大幅修改。 Microsoft 對此處提供的資訊,不做任何明確或隱含的瑕疵擔保。
收到目前申請的請求 HttpServerUtility 。
public:
property System::Web::HttpServerUtility ^ Server { System::Web::HttpServerUtility ^ get(); };
[System.ComponentModel.Browsable(false)]
public System.Web.HttpServerUtility Server { get; }
[<System.ComponentModel.Browsable(false)>]
member this.Server : System.Web.HttpServerUtility
Public ReadOnly Property Server As HttpServerUtility
屬性值
- 屬性
範例
以下範例會回傳使用屬性 Server 的網頁伺服器電腦名稱。
<%@ WebService Language="C#" Class="Util" %>
using System.Web.Services;
public class Util: WebService {
[ WebMethod(Description="Obtains the Server Computer Name",EnableSession=false)]
public string GetMachineName() {
return Server.MachineName;
}
}
<%@ WebService Language="VB" Class="Util" %>
Imports System.Web.Services
Public Class Util
Inherits WebService
<WebMethod(Description := "Obtains the Computer Machine Name", _
EnableSession := False)> _
Public Function GetMachineName() As String
Return Server.MachineName
End Function
End Class
備註
該 HttpServerUtility 類別提供了多種可用於處理網頁請求的方法,包括 CreateObject (用於實例化 COM 物件)。