2 つのエンドポイントを持つ WCF サービスへの参照を追加しました。サービスを追加すると、次が構成ファイルに追加されます。
<client>
<endpoint name="ABCServiceV1" address="http://staging.ABCwebservices.com/ABC/Service.svc"
binding="basicHttpBinding" bindingConfiguration="ABCServiceV1"
contract="ABCService.IService" />
<endpoint name="ABCServiceV2" address="http://staging.ABCwebservices.com/ABC/Service.svc/20"
binding="basicHttpBinding" bindingConfiguration="ABCServiceV2"
contract="ABCService.IService1" />
</client>
クライアントを作成するコードは次のとおりです。
ABCService.ServiceClient ABCClient = new ServiceClient("ABCServiceV2");
ただし、ランタイム エラーが発生します。この名前に一致するエンドポイント要素がクライアント要素で見つかりました。」
私が使用した場合ABCService.ServiceClient ABCClient = new ServiceClient("ABCServiceV1");
、すべて正常に動作します。しかし、ABCServiceV2 を使用する場合、ABCService.IService1 を探す必要があるのに、Contract - ABCService.IService を探します。
正しいコントラクトのように見せるにはどうすればよいですか?