MetadataResolver.Resolve 메서드
정의
중요
일부 정보는 릴리스되기 전에 상당 부분 수정될 수 있는 시험판 제품과 관련이 있습니다. Microsoft는 여기에 제공된 정보에 대해 어떠한 명시적이거나 묵시적인 보증도 하지 않습니다.
메타데이터 주소를 다운로드하여 해당 서비스의 개체로 ServiceEndpoint 확인합니다.
오버로드
| Name | Description |
|---|---|
| Resolve(IEnumerable<ContractDescription>, EndpointAddress) |
지정된 메타데이터 주소를 사용하여 지정된 계약의 개체로 ServiceEndpoint 메타데이터 주소를 확인합니다. |
| Resolve(Type, EndpointAddress) |
지정된 주소에서 지정된 계약에 대한 개체 컬렉션 ServiceEndpoint 으로 메타데이터 주소를 다운로드하고 확인합니다. |
| Resolve(IEnumerable<ContractDescription>, EndpointAddress, MetadataExchangeClient) |
지정된 메타데이터 주소를 사용하여 지정된 계약의 개체로 ServiceEndpoint 메타데이터 주소를 확인합니다 MetadataExchangeClient. |
| Resolve(IEnumerable<ContractDescription>, Uri, MetadataExchangeClientMode) |
지정된 주소 및 전송 모드를 사용하여 지정된 계약의 개체로 ServiceEndpoint 메타데이터 주소를 확인합니다. |
| Resolve(Type, Uri, MetadataExchangeClientMode) |
지정된 주소 및 전송 모드를 사용하여 지정된 계약의 개체로 ServiceEndpoint 메타데이터 주소를 확인합니다. |
| Resolve(IEnumerable<ContractDescription>, Uri, MetadataExchangeClientMode, MetadataExchangeClient) |
지정된 주소, 전송 모드 및 전송 클라이언트를 사용하여 지정된 계약의 개체로 ServiceEndpoint 메타데이터 주소를 확인합니다. |
설명
메타데이터를 다운로드하지만 개체로 ServiceEndpoint 정보를 해결하지 않려면 직접 사용합니다 System.ServiceModel.Description.MetadataExchangeClient .
모든 동기 및 비동 Resolve 기 메서드의 경우 엔드포인트를 가져오지 않거나 계약과 일치하는 엔드포인트가 없는 경우 빈 컬렉션이 반환됩니다. 빈 컬렉션이 반환되면 경고 추적이 기록됩니다.
Resolve(IEnumerable<ContractDescription>, EndpointAddress)
지정된 메타데이터 주소를 사용하여 지정된 계약의 개체로 ServiceEndpoint 메타데이터 주소를 확인합니다.
public:
static System::ServiceModel::Description::ServiceEndpointCollection ^ Resolve(System::Collections::Generic::IEnumerable<System::ServiceModel::Description::ContractDescription ^> ^ contracts, System::ServiceModel::EndpointAddress ^ address);
public static System.ServiceModel.Description.ServiceEndpointCollection Resolve(System.Collections.Generic.IEnumerable<System.ServiceModel.Description.ContractDescription> contracts, System.ServiceModel.EndpointAddress address);
static member Resolve : seq<System.ServiceModel.Description.ContractDescription> * System.ServiceModel.EndpointAddress -> System.ServiceModel.Description.ServiceEndpointCollection
Public Shared Function Resolve (contracts As IEnumerable(Of ContractDescription), address As EndpointAddress) As ServiceEndpointCollection
매개 변수
- contracts
- IEnumerable<ContractDescription>
메타데이터를 다운로드하고 확인할 계약입니다.
- address
- EndpointAddress
메타데이터 주소입니다.
반품
지정된 계약의 개체 컬렉션 ServiceEndpoint 입니다.
예외
주소 또는 계약 컬렉션입니다 null.
contracts 가 비어 있거나, 하나 이상의 멤버 contracts 가 null이거나 contracts , 동일한 이름과 네임스페이스를 가진 둘 이상의 계약을 포함합니다.
설명
기본 설정 System.ServiceModel.Description.MetadataExchangeClient 은 메타데이터를 검색하는 데 사용되며 기본값 System.ServiceModel.Description.MetadataExchangeClientMode 은 .입니다 MetadataExchangeClientMode.MetadataExchange.
메타데이터를 다운로드하지만 개체로 ServiceEndpoint 정보를 해결하지 않려면 직접 사용합니다 System.ServiceModel.Description.MetadataExchangeClient .
메모
엔드포인트를 가져오지 않거나 계약과 일치하는 엔드포인트가 없는 경우 빈 컬렉션이 반환됩니다. 빈 컬렉션이 반환되면 경고 추적이 기록됩니다.
적용 대상
Resolve(Type, EndpointAddress)
지정된 주소에서 지정된 계약에 대한 개체 컬렉션 ServiceEndpoint 으로 메타데이터 주소를 다운로드하고 확인합니다.
public:
static System::ServiceModel::Description::ServiceEndpointCollection ^ Resolve(Type ^ contract, System::ServiceModel::EndpointAddress ^ address);
public static System.ServiceModel.Description.ServiceEndpointCollection Resolve(Type contract, System.ServiceModel.EndpointAddress address);
static member Resolve : Type * System.ServiceModel.EndpointAddress -> System.ServiceModel.Description.ServiceEndpointCollection
Public Shared Function Resolve (contract As Type, address As EndpointAddress) As ServiceEndpointCollection
매개 변수
- contract
- Type
메타데이터를 다운로드하고 확인할 계약입니다.
- address
- EndpointAddress
메타데이터 주소입니다.
반품
지정된 계약의 개체 컬렉션 ServiceEndpoint 입니다.
예외
주소 또는 계약이 .입니다 null.
예제
다음 코드 예제에서는 클래스를 MetadataResolver 사용하여 메타데이터를 서비스 인스턴스에 연결하는 데 사용되는 개체 컬렉션 ServiceEndpoint 으로 반환하는 방법을 보여 줍니다.
// Get the endpoints for such a service
ServiceEndpointCollection endpoints = MetadataResolver.Resolve(typeof(SampleServiceClient), metaAddress);
Console.WriteLine("Trying all available WS-Transfer metadata endpoints...");
foreach (ServiceEndpoint point in endpoints)
{
if (point != null)
{
// Create a new wcfClient using retrieved endpoints.
wcfClient = new SampleServiceClient(point.Binding, point.Address);
Console.WriteLine(
wcfClient.SampleMethod("Client used the "
+ point.Address.ToString()
+ " address.")
);
wcfClient.Close();
}
}
설명
메서드를 Resolve 사용하여 메타데이터를 다운로드하고 확인할 때 사용할 계약 및 메타데이터 주소를 지정합니다.
기본 설정 System.ServiceModel.Description.MetadataExchangeClient 은 메타데이터를 검색하는 데 사용되며 기본값 System.ServiceModel.Description.MetadataExchangeClientMode 은 .입니다 MetadataExchangeClientMode.MetadataExchange.
메타데이터를 다운로드하지만 개체로 ServiceEndpoint 정보를 해결하지 않려면 직접 사용합니다 System.ServiceModel.Description.MetadataExchangeClient .
메모
엔드포인트를 가져오지 않거나 계약과 일치하는 엔드포인트가 없는 경우 빈 컬렉션이 반환됩니다. 빈 컬렉션이 반환되면 경고 추적이 기록됩니다.
이 메서드를 사용하려면 계약 유형을 지정해야 합니다. 클라이언트 코드에서 서비스 인터페이스를 선언하거나 Svcutil.exe생성된 WCF 클라이언트를 사용하여 계약을 지정할 수 있습니다. 인터페이스가 변경되면(예: 새 작업 추가) 클라이언트 코드에서 인터페이스를 업데이트하거나 새 WCF 클라이언트를 생성해야 합니다. 그렇지 않으면 예외가 throw됩니다. 예를 들어 Add(), Sub(), Mult() 및 Div()를 정의하는 ICalculator라는 서비스 계약을 구현하는 서비스가 있습니다. 클라이언트 애플리케이션을 만들고 WCF 클라이언트를 생성합니다. 그런 다음 Echo()라는 메서드를 ICalculator에 추가합니다. 그런 다음 새 WCF 클라이언트를 생성하지 않고 호출 Resolve(Type, EndpointAddress) 하는 애플리케이션을 작성하는 경우 다음 예외가 발생합니다.
Unhandled Exception: System.ServiceModel.Description.WsdlImporter+WsdlImportException: Cannot locate operation Echo in Contract ICalculator;
적용 대상
Resolve(IEnumerable<ContractDescription>, EndpointAddress, MetadataExchangeClient)
지정된 메타데이터 주소를 사용하여 지정된 계약의 개체로 ServiceEndpoint 메타데이터 주소를 확인합니다 MetadataExchangeClient.
public:
static System::ServiceModel::Description::ServiceEndpointCollection ^ Resolve(System::Collections::Generic::IEnumerable<System::ServiceModel::Description::ContractDescription ^> ^ contracts, System::ServiceModel::EndpointAddress ^ address, System::ServiceModel::Description::MetadataExchangeClient ^ client);
public static System.ServiceModel.Description.ServiceEndpointCollection Resolve(System.Collections.Generic.IEnumerable<System.ServiceModel.Description.ContractDescription> contracts, System.ServiceModel.EndpointAddress address, System.ServiceModel.Description.MetadataExchangeClient client);
static member Resolve : seq<System.ServiceModel.Description.ContractDescription> * System.ServiceModel.EndpointAddress * System.ServiceModel.Description.MetadataExchangeClient -> System.ServiceModel.Description.ServiceEndpointCollection
Public Shared Function Resolve (contracts As IEnumerable(Of ContractDescription), address As EndpointAddress, client As MetadataExchangeClient) As ServiceEndpointCollection
매개 변수
- contracts
- IEnumerable<ContractDescription>
메타데이터를 다운로드하고 확인할 계약입니다.
- address
- EndpointAddress
메타데이터 주소입니다.
- client
- MetadataExchangeClient
MetadataExchangeClient 메타데이터를 검색하는 데 사용되는 항목입니다.
반품
지정된 계약의 개체 컬렉션 ServiceEndpoint 입니다.
예외
주소, 계약 컬렉션 또는 클라이언트는 null.
contracts 가 비어 있거나, 하나 이상의 멤버 contracts 가 null이거나 contracts , 동일한 이름과 네임스페이스를 가진 둘 이상의 계약을 포함합니다.
설명
기본 System.ServiceModel.Description.MetadataExchangeClientMode는 MetadataExchangeClientMode.MetadataExchange입니다.
메타데이터를 다운로드하지만 개체로 ServiceEndpoint 정보를 해결하지 않려면 직접 사용합니다 System.ServiceModel.Description.MetadataExchangeClient .
메모
엔드포인트를 가져오지 않거나 계약과 일치하는 엔드포인트가 없는 경우 빈 컬렉션이 반환됩니다. 빈 컬렉션이 반환되면 경고 추적이 기록됩니다.
적용 대상
Resolve(IEnumerable<ContractDescription>, Uri, MetadataExchangeClientMode)
지정된 주소 및 전송 모드를 사용하여 지정된 계약의 개체로 ServiceEndpoint 메타데이터 주소를 확인합니다.
public:
static System::ServiceModel::Description::ServiceEndpointCollection ^ Resolve(System::Collections::Generic::IEnumerable<System::ServiceModel::Description::ContractDescription ^> ^ contracts, Uri ^ address, System::ServiceModel::Description::MetadataExchangeClientMode mode);
public static System.ServiceModel.Description.ServiceEndpointCollection Resolve(System.Collections.Generic.IEnumerable<System.ServiceModel.Description.ContractDescription> contracts, Uri address, System.ServiceModel.Description.MetadataExchangeClientMode mode);
static member Resolve : seq<System.ServiceModel.Description.ContractDescription> * Uri * System.ServiceModel.Description.MetadataExchangeClientMode -> System.ServiceModel.Description.ServiceEndpointCollection
Public Shared Function Resolve (contracts As IEnumerable(Of ContractDescription), address As Uri, mode As MetadataExchangeClientMode) As ServiceEndpointCollection
매개 변수
- contracts
- IEnumerable<ContractDescription>
메타데이터를 다운로드하고 확인할 계약입니다.
- address
- Uri
메타데이터 주소입니다.
검색 모드입니다.
반품
지정된 계약의 개체 컬렉션 ServiceEndpoint 입니다.
예외
주소 또는 계약 컬렉션입니다 null.
contracts 가 비어 있거나, 하나 이상의 멤버 contracts 가 null이거나 contracts , 동일한 이름과 네임스페이스를 가진 둘 이상의 계약을 포함합니다.
설명
메타데이터를 System.ServiceModel.Description.MetadataExchangeClient 검색하는 데 사용되는 기본 설정입니다.
메타데이터를 다운로드하지만 개체로 ServiceEndpoint 정보를 해결하지 않려면 직접 사용합니다 System.ServiceModel.Description.MetadataExchangeClient .
메모
엔드포인트를 가져오지 않거나 계약과 일치하는 엔드포인트가 없는 경우 빈 컬렉션이 반환됩니다. 빈 컬렉션이 반환되면 경고 추적이 기록됩니다.
적용 대상
Resolve(Type, Uri, MetadataExchangeClientMode)
지정된 주소 및 전송 모드를 사용하여 지정된 계약의 개체로 ServiceEndpoint 메타데이터 주소를 확인합니다.
public:
static System::ServiceModel::Description::ServiceEndpointCollection ^ Resolve(Type ^ contract, Uri ^ address, System::ServiceModel::Description::MetadataExchangeClientMode mode);
public static System.ServiceModel.Description.ServiceEndpointCollection Resolve(Type contract, Uri address, System.ServiceModel.Description.MetadataExchangeClientMode mode);
static member Resolve : Type * Uri * System.ServiceModel.Description.MetadataExchangeClientMode -> System.ServiceModel.Description.ServiceEndpointCollection
Public Shared Function Resolve (contract As Type, address As Uri, mode As MetadataExchangeClientMode) As ServiceEndpointCollection
매개 변수
- contract
- Type
메타데이터를 다운로드하고 확인할 계약입니다.
- address
- Uri
메타데이터 주소입니다.
검색 모드입니다.
반품
지정된 계약의 개체 컬렉션 ServiceEndpoint 입니다.
예외
주소 또는 계약입니다 null.
예제
다음 코드 예제에서는 WS-Transfer가 아닌 HTTP GET 요청을 사용하여 메타데이터를 다운로드하고 개체 컬렉션 MetadataResolver 으로 반환하는 방법을 ServiceEndpoint 보여 줍니다.
// Get the endpoints for such a service using Http/Get request
endpoints = MetadataResolver.Resolve(typeof(SampleServiceClient), httpGetMetaAddress.Uri, MetadataExchangeClientMode.HttpGet);
Client.WriteParameters(endpoints);
ISampleService serviceChannel;
Console.WriteLine(
"\r\nTrying all endpoints from HTTP/Get and with direct service channels...");
foreach (ServiceEndpoint point in endpoints)
{
if (point != null)
{
ChannelFactory<ISampleService> factory = new ChannelFactory<ISampleService>(point.Binding);
factory.Endpoint.Address = point.Address;
serviceChannel = factory.CreateChannel();
Console.WriteLine("Client used the " + point.Address.ToString() + " address.");
Console.WriteLine(
serviceChannel.SampleMethod(
"Client used the " + point.Address.ToString() + " address."
)
);
factory.Close();
}
}
설명
이 메서드를 Resolve 사용하여 계약 및 주소 및 사용할 다운로드 메커니즘을 지정합니다.
메타데이터를 System.ServiceModel.Description.MetadataExchangeClient 검색하는 데 사용되는 기본 설정입니다.
메타데이터를 다운로드하지만 개체로 ServiceEndpoint 정보를 해결하지 않려면 직접 사용합니다 System.ServiceModel.Description.MetadataExchangeClient .
메모
엔드포인트를 가져오지 않거나 계약과 일치하는 엔드포인트가 없는 경우 빈 컬렉션이 반환됩니다. 빈 컬렉션이 반환되면 경고 추적이 기록됩니다.
적용 대상
Resolve(IEnumerable<ContractDescription>, Uri, MetadataExchangeClientMode, MetadataExchangeClient)
지정된 주소, 전송 모드 및 전송 클라이언트를 사용하여 지정된 계약의 개체로 ServiceEndpoint 메타데이터 주소를 확인합니다.
public:
static System::ServiceModel::Description::ServiceEndpointCollection ^ Resolve(System::Collections::Generic::IEnumerable<System::ServiceModel::Description::ContractDescription ^> ^ contracts, Uri ^ address, System::ServiceModel::Description::MetadataExchangeClientMode mode, System::ServiceModel::Description::MetadataExchangeClient ^ client);
public static System.ServiceModel.Description.ServiceEndpointCollection Resolve(System.Collections.Generic.IEnumerable<System.ServiceModel.Description.ContractDescription> contracts, Uri address, System.ServiceModel.Description.MetadataExchangeClientMode mode, System.ServiceModel.Description.MetadataExchangeClient client);
static member Resolve : seq<System.ServiceModel.Description.ContractDescription> * Uri * System.ServiceModel.Description.MetadataExchangeClientMode * System.ServiceModel.Description.MetadataExchangeClient -> System.ServiceModel.Description.ServiceEndpointCollection
Public Shared Function Resolve (contracts As IEnumerable(Of ContractDescription), address As Uri, mode As MetadataExchangeClientMode, client As MetadataExchangeClient) As ServiceEndpointCollection
매개 변수
- contracts
- IEnumerable<ContractDescription>
메타데이터를 다운로드하고 확인할 계약입니다.
- address
- Uri
메타데이터 주소입니다.
검색 모드입니다.
- client
- MetadataExchangeClient
MetadataExchangeClient 메타데이터를 검색하는 데 사용되는 항목입니다.
반품
지정된 계약의 개체 컬렉션 ServiceEndpoint 입니다.
예외
주소, 계약 컬렉션 또는 클라이언트는 null.
contracts 가 비어 있거나, 하나 이상의 멤버 contracts 가 null이거나 contracts , 동일한 이름과 네임스페이스를 가진 둘 이상의 계약을 포함합니다.
설명
메타데이터를 다운로드하지만 개체로 ServiceEndpoint 정보를 해결하지 않려면 직접 사용합니다 System.ServiceModel.Description.MetadataExchangeClient .
메모
엔드포인트를 가져오지 않거나 계약과 일치하는 엔드포인트가 없는 경우 빈 컬렉션이 반환됩니다. 빈 컬렉션이 반환되면 경고 추적이 기록됩니다.