【问题标题】:WCF Service over HTTPS giving errorsWCF 服务通过 HTTPS 给出错误
【发布时间】:2012-10-10 13:17:33
【问题描述】:

我做了一个WCF服务,配置如下:

  <!-- This is the binding for SSL-->
  <wsHttpBinding>
    <binding name="SSLBinding">
      <security mode="Transport" >
        <transport clientCredentialType="None" ></transport>            
      </security>
    </binding>       
  </wsHttpBinding>  
  <!-- SSL Binding Ends here.-->

</bindings>

<behaviors>
  <serviceBehaviors>

    <!-- This is the behavior we have defined for SSL configuration-->
    <behavior name="SSLBehavior">
      <serviceMetadata httpsGetEnabled="True"/>          
    </behavior>
    <!-- SSL Behavior Ends here -->        
  </serviceBehaviors>
</behaviors>

<services>
  <!-- Service configured alongwith its Mex Endpoint-->      
  <service name="CalculatorService.Service1" behaviorConfiguration="SSLBehavior">
    <endpoint contract="CalculatorService.IService1" name="SSLAddress" binding="wsHttpBinding"  bindingConfiguration="SSLBinding"></endpoint>
    <endpoint name="mex"  binding="mexHttpsBinding" contract="IMetadataExchange"></endpoint>
  </service> 

</services>
<serviceHostingEnvironment multipleSiteBindingsEnabled="false" />

我已使用以下教程在 IIS 5.1 上的 WCF 服务上托管 SSL http://www.codeproject.com/Articles/36705/7-simple-steps-to-enable-HTTPS-on-WCF-WsHttp-bindi

我得到的错误是

A binding instance has already been associated to listen URI 
'https://wd-xpa7kyy12d3.XXXX.com/CalculatorService/Service1.svc'. If two endpoints want to share the same ListenUri, they must also share the same binding object instance. The two conflicting endpoints were either specified in AddServiceEndpoint() calls, in a config file, or a combination of AddServiceEndpoint() and config. 

在名为“SSLAddress”的端点中,我将“地址”添加为“https://wd-xpa7kyy12d3.XXXX.com/CalculatorService/Service1.svc”,但无法使用此 URL 添加服务引用,必须具体给出WSDL路径。

即使在向控制台应用程序成功提供 WSDL 路径并添加服务引用后,客户端代理在执行方法时仍然报错。所以我从端点中删除了地址属性,现在这个问题来了。我不确定当前配置有什么问题?感谢您的帮助。

【问题讨论】:

    标签: wcf ssl wcf-hosting


    【解决方案1】:

    尝试添加

    address="mex"
    

    到您的元数据端点。 指定的地址最终是一个相对路径,所以它会被给出

    https://wd-xpa7kyy12d3.XXXX.com/CalculatorService/Service1.svc/mex
    

    作为地址。另一个端点将保持在

    https://wd-xpa7kyy12d3.XXXX.com/CalculatorService/Service1.svc
    

    【讨论】:

      猜你喜欢
      • 2012-04-30
      • 2010-11-19
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2011-09-25
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多