wcf - 服务端点错误

标签 wcf windows-phone-7

我写了一个简单的 wp7 应用程序。它使用 wcf 服务和文件来存储用户提供的数据。 我可以成功运行该应用程序而没有错误,但我收到运行时错误: “找不到契约(Contract)‘ServiceReference1.IService1’的端点配置部分,因为找到了该契约(Contract)的多个端点配置。请按名称指明首选端点配置部分” acf 包含以下端点配置集

 <services>
      <service name="WcfDataWallet.Service1">
        <endpoint address="" binding="basicHttpBinding" bindingConfiguration="NewBinding0"
          contract="WcfDataWallet.IService1">
          <identity>
            <dns value="localhost" />
          </identity>
        </endpoint>
        <endpoint address="mex" binding="mexHttpBinding" contract="IMetadataExchange" />

谁能帮帮我

最佳答案

我刚刚遇到了同样的问题。我只在 VS 2010 中向我的项目添加了 1 个服务引用,但是,我注意到在 web.config 中添加了 2 个端点

我刚刚注释掉了第二个端点,因为我很确定我不需要它。

因此之前

<endpoint address="http://web_services.u.aco/ServicesLocations/1_1/LocationsService.svc"
    binding="wsHttpBinding" bindingConfiguration="WSHttpBinding_ILocationsService"
    contract="LocationService.ILocationsService" name="WSHttpBinding_ILocationsService" />
  <endpoint address="http://web_services.u.aco/ServicesLocations/1_1/LocationsService.svc/basic"
    binding="basicHttpBinding" bindingConfiguration="BasicHttpBinding_ILocationsService"
    contract="LocationService.ILocationsService" name="BasicHttpBinding_ILocationsService" />

改为:

<endpoint address="http://web_services.u.aco/ServicesLocations/1_1/LocationsService.svc"
    binding="wsHttpBinding" bindingConfiguration="WSHttpBinding_ILocationsService"
    contract="LocationService.ILocationsService" name="WSHttpBinding_ILocationsService" />
  <!--<endpoint address="http://web_services.u.aco/ServicesLocations/1_1/LocationsService.svc/basic"
    binding="basicHttpBinding" bindingConfiguration="BasicHttpBinding_ILocationsService"
    contract="LocationService.ILocationsService" name="BasicHttpBinding_ILocationsService" />-->

现在可以使用了!

关于wcf - 服务端点错误,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/5879455/

相关文章:

html - 在 Windows Phone 7 应用程序中流式传输音频

c# - 从保留的 ListBox 中获取选定的项目

c# - 通过 WCF 的 ObservableCollection

asp.net - ASP .NET,WCF 并发控制

windows-phone-7 - 我可以在不通过App Store的情况下为Windows Phone 7开发个人应用程序吗?

html - 如何在 WP7 - Phonegap 中播放嵌入视频?

c# - 照片相机 API : how to properly dispose it?

wcf - WsDualHttpBinding 不回调客户端,及时处理问题

c# - WCF - 如何从基类型向客户端公开强类型对象(无需客户端转换?)

WCF/Web 服务充当 MQ 消息的监听器?