WebServiceBindingAttribute.Location 屬性

定義

取得或設定定義繫結的位置。

public:
 property System::String ^ Location { System::String ^ get(); void set(System::String ^ value); };
public string Location { get; set; }
member this.Location : string with get, set
Public Property Location As String

屬性值

String

定義繫結的位置。 預設值為屬性所套用至的 XML Web Service 的 URL。

範例

下列範例會指定名為 RemoteBinding 的系結,該系結是命名空間的成員 http://www.contoso.com/MyBinding ,且定義于 http://www.contoso.com/MyService.asmx?wsdl

<%@ WebService language="C#" class="BindingSample" %>

using System.Web;
using System.Web.Services;
using System.Web.Services.Protocols;

// Binding is defined on a remote server, but this XML Web service 
// implements at least one operation in that binding.
[ WebServiceBinding(Name="RemoteBinding",
    Namespace="http://www.contoso.com/MyBinding",
    Location="http://www.contoso.com/MyService.asmx?wsdl")]
public class BindingSample  
{
    [ SoapDocumentMethod(Binding="RemoteBinding")] 
    [ WebMethod() ]
    public string RemoteBindingMethod() 
    {
        return "Member of a binding defined on another server";
    }
}
<%@ WebService language="VB" class="BindingSample" %>

Imports System.Web
Imports System.Web.Services
Imports System.Web.Services.Protocols

' <Snippet1>
' Binding is defined on a remote server, but this XML Web service implements at
' least one operation in that binding.
<WebServiceBinding(Name := "RemoteBinding", _
    Namespace := "http://www.contoso.com/MyBinding", _
    Location := "http://www.contoso.com/MyService.asmx?wsdl")> _
Public Class BindingSample
        
    <SoapDocumentMethod(Binding := "RemoteBinding"), WebMethod()> _
    Public Function RemoteBindingMethod() As String
        Return "Member of a binding defined on another server"
    End Function
End Class

' </Snippet1>

適用於

另請參閱