WebClientProtocol.Url 屬性
定義
重要
部分資訊涉及發行前產品,在發行之前可能會有大幅修改。 Microsoft 對此處提供的資訊,不做任何明確或隱含的瑕疵擔保。
取得或設定客戶端所請求的 XML Web 服務的基礎 URL。
public:
property System::String ^ Url { System::String ^ get(); void set(System::String ^ value); };
public string Url { get; set; }
[System.ComponentModel.SettingsBindable(true)]
public string Url { get; set; }
member this.Url : string with get, set
[<System.ComponentModel.SettingsBindable(true)>]
member this.Url : string with get, set
Public Property Url As String
屬性值
客戶端所請求的 XML Web 服務的基礎網址。 預設值為 Empty。
- 屬性
範例
以下範例將 XML Web 服務的屬性math改Url為名為 http:// www.contoso.com的 Web 伺服器。
// Set the URL property to a different Web server than that described in the
// service description.
math->Url = "http://www.contoso.com/math.asmx";
int total = math->Add( Convert::ToInt32( Num1.Text ), Convert::ToInt32( Num2.Text ) );
// Set the URL property to a different Web server than that described in the
// service description.
math.Url = "http://www.contoso.com/math.asmx";
int total = math.Add(Convert.ToInt32(Num1.Text), Convert.ToInt32(Num2.Text));
' Set the URL property to a different Web server than that described in the
' service description.
math.Url = "http://www.contoso.com/math.asmx"
Dim total As Integer = math.Add(Convert.ToInt32(Num1.Text), _
Convert.ToInt32(Num2.Text))
備註
使用 Wsdl.exe 產生的代理類別會設定一個預設 Url 屬性供用戶端使用。 預設 Url 值由代理類別產生的服務描述中所屬的位置屬性決定。
支援特定協定的衍生類別,例如 HttpGetClientProtocol 和 HttpPostClientProtocol ,可能會加入額外資訊 Url 以提出 XML Web 服務請求。
該 Url 屬性可更改為指任何實作與代理類別相同服務描述的 XML 網路服務。