【问题标题】:service endpoint error服务端点错误
【发布时间】:2011-05-04 06:32:37
【问题描述】:

我编写了一个简单的 wp7 应用程序。它使用 wcf 服务和文件来存储用户提供的数据。 我可以成功运行应用程序而没有错误,但我得到一个运行时错误: “找不到合同‘ServiceReference1.IService1’的端点配置部分,因为找到了该合同的多个端点配置。请按名称指明首选端点配置部分” 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" />

谁能帮帮我

【问题讨论】:

    标签: wcf windows-phone-7


    【解决方案1】:

    我也遇到了同样的问题。我在 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" />-->
    

    现在工作!

    【讨论】:

      【解决方案2】:

      试试这个

      MyClientProxy proxy = new MyClientProxy("endpoint name"); eg EndPointNameXXX
      

      “端点名称”应指向客户端配置文件中的端点之一。

      <endpoint address="http://[SERVER]/Service"
                      binding="basicHttpBinding" bindingConfiguration="bindingConfig"
                      contract="IXXXX.YYYY" name="EndPointNameXXX" />
      

      【讨论】:

        猜你喜欢
        • 1970-01-01
        • 1970-01-01
        • 1970-01-01
        • 1970-01-01
        • 2016-06-19
        • 1970-01-01
        • 1970-01-01
        • 1970-01-01
        • 2016-08-19
        相关资源
        最近更新 更多