次のエンドポイントを持つサービスがあります。
<endpoint address="" binding="basicHttpBinding" bindingConfiguration=""
name="SomeServiceDotNetEndpoint" contract="Contracts.ISomeService" />
このサービス参照を別のプロジェクトに追加すると、アプリ構成ファイルに次のクライアント エンドポイントが表示されます。
<endpoint address="http://test.example.com/Services/SomeService.svc"
binding="basicHttpBinding" bindingConfiguration="BasicHttpBinding_ISomeService"
contract="SomeService.ISomeService" name="BasicHttpBinding_ISomeService" />
現在、この名前のエンドポイントはBasicHttpBinding_ISomeService
、サービスの Web 構成ファイルで定義されていません。次のコードで新しいチャネル ファクトリを作成しようとすると:
var someServiceChannelFactory = new ChannelFactory<ISomeService>("SomeServiceDotNetEndPoint", endpoint);
失敗し、そのアドレスに一致するコントラクト/エンドポイントがないことを教えてくれます。私も使用してみまし"BasicHttpBinding_ISomeService"
たが、同じエラーが発生します。
Could not find endpoint element with name 'SomeServiceDotNetEndPoint' and
contract 'SomeService.ISomeService' in the ServiceModel client configuration
section. This might be because no configuration file was found for your
application, or because no endpoint element matching this name could be found
in the client element.
では、どこBasicHttpBinding_ISomeService
から来たのか、元のエンドポイント名が上書きされたのはなぜですか、また、ヒットしようとしているエンドポイントをサービスに認識させるにはどうすればよいでしょうか?