【发布时间】:2013-05-07 19:55:11
【问题描述】:
我有一个带有以下端点的服务:
<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 是从哪里来的,为什么我的原始端点名称被覆盖了,我怎样才能让服务识别我试图命中的端点?
【问题讨论】:
标签: .net wcf service wcf-configuration