0

因此,当我尝试创建我的 Web 服务的新实例时,我得到了一个异常,它说:

“在 ServiceModel 客户端配置部分中找不到引用合同 'KBBVehicleService.IVehicleInformationService' 的默认端点元素。这可能是因为找不到您的应用程序的配置文件,或者因为在客户端元素中找不到与此合同匹配的端点元素。”

这是一个将连接到 Kelley Blue Book 的 Web 服务。

我知道我的 Web.Config 中需要一个新的端点条目,但这是什么样的?

我添加的一个看起来像这样:

<endpoint address="http://localhost:3300/KBB.svc" binding="basicHttpBinding" bindingConfiguration="BasicHttpBinding_Default" contract="Services.Client.IVehicleInformationService"/>

但它不起作用。仍然在同一个地方抛出同样的异常。

有任何想法吗?

4

2 回答 2

2

Could not find default endpoint element that references contract 'ServiceReference.IWebService' 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 contract could be found in the client element.

于 2011-03-17T02:20:26.900 回答
0

正如异常消息所建议的那样,使用正确的合同类型:

<endpoint 
    address="http://localhost:3300/KBB.svc" 
    binding="basicHttpBinding" 
    bindingConfiguration="BasicHttpBinding_Default" 
    contract="KBBVehicleService.IVehicleInformationService"
/>
于 2010-09-02T19:06:35.523 回答