2012-10-10 100 views
1

我與配置的WCF服務如下:WCF服務通過HTTPS給錯誤

<!-- 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" /> 

我已經使用了下面的教程主辦WCF服務SSL在IIS 5.1 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路徑併成功將服務引用添加到控制檯應用程序後,當客戶端代理執行這些方法時,它也會報錯。所以我從端點中刪除了地址屬性,現在這個問題即將到來。我不確定當前配置有什麼問題?感謝幫助。

回答

1

嘗試添加

address="mex" 

你的元數據端點。 指定的地址最終被相對路徑,所以將給出

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

作爲地址。另一端點將保持在

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

你是好人。有效。謝謝。 –