通过


WebClientProtocol.Url 属性

定义

获取或设置客户端请求的 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 服务的基 URL。 默认值为 Empty

属性

示例

以下示例将 Url XML Web 服务的属性 math 更改为名为 http:// www.contoso.comWeb 服务器的属性。

// 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 Web 服务。

适用于

另请参阅