WebClientProtocol.Url 屬性

定義

取得或設定用戶端正在要求之 XML Web Service 的基礎 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 Service 的基礎 URL。 預設為 Empty

屬性

範例

下列範例會將 Url XML Web 服務的 屬性 math 變更為名為 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 產生的 Proxy 類別會設定用戶端要使用的預設 Url 屬性。 預設值 Url 取決於從中產生 Proxy 類別的服務描述中找到的位置屬性。

支援特定通訊協定的衍生類別,例如 HttpGetClientProtocolHttpPostClientProtocol 可能會新增額外的資訊, Url 以提出 XML Web 服務要求。

Url屬性可以變更,以參考任何實作 Proxy 類別所產生之相同服務描述的 XML Web 服務。

適用於

另請參閱