2011-04-18 77 views
5

我在Visual Studio 2010中的IIS Express在IIS快遞主辦的純WCF服務WCF服務配置爲使用SSL。無法添加服務引用在IIS快遞託管與SSL

切換到SSL之前,我沒有問題,但現在我不能更新是添加一個服務引用到我的WCF服務(這僅僅是一個正常的IIS託管SVC文件)。

當我使用WCFTestClient,我得到多一點有用的錯誤:

Error: Cannot obtain Metadata from https://localhost:44302/Services/TrueChecksService.svc If this is a Windows (R) Communication Foundation service to which you have access, please check that you have enabled metadata publishing at the specified address. For help enabling metadata publishing, please refer to the MSDN documentation at http://go.microsoft.com/fwlink/?LinkId=65455 .WS-Metadata Exchange Error URI: https://localhost:44302/Services/TrueChecksService.svc Metadata contains a reference that cannot be resolved: 'https://localhost:44302/Services/TrueChecksService.svc'. Could not establish trust relationship for the SSL/TLS secure channel with authority 'localhost:44302'. The underlying connection was closed: Could not establish trust relationship for the SSL/TLS secure channel. The remote certificate is invalid according to the validation procedure.HTTP GET Error URI: https://localhost:44302/Services/TrueChecksService.svc There was an error downloading 'https://localhost:44302/Services/TrueChecksService.svc'. The underlying connection was closed: Could not establish trust relationship for the SSL/TLS secure channel. The remote certificate is invalid according to the validation procedure.

這裏是我的配置在當下:

<system.serviceModel> 
<serviceHostingEnvironment aspNetCompatibilityEnabled="true" multipleSiteBindingsEnabled="true" /> 
<bindings> 
    <basicHttpBinding> 
    <binding name="MyBasicHttpBindingConfig" receiveTimeout="00:15:00" 
     sendTimeout="00:15:00" maxBufferSize="2147483647" maxReceivedMessageSize="2147483647"> 
     <security mode="Transport" /> 
    </binding> 
    </basicHttpBinding>  
</bindings> 
<services> 
    <service name="TrueChecksService" behaviorConfiguration="TrueChecksServiceBehavior"> 
    <endpoint binding="basicHttpBinding" bindingConfiguration="MyBasicHttpBindingConfig" 
     name="TrueChecksServiceEndpoint" contract="TrueChecksAdminSL.Web.Services.ITrueChecksService" /> 
    <endpoint address="mex" binding="mexHttpsBinding" contract="IMetadataExchange" /> 
    </service> 
</services> 
<behaviors> 
    <serviceBehaviors> 
    <behavior name="TrueChecksServiceBehavior"> 
     <useRequestHeadersForMetadataAddress> 
     <defaultPorts> 
      <add port="44302" scheme="https"/> 
     </defaultPorts> 
     </useRequestHeadersForMetadataAddress> 
     <serviceMetadata httpGetEnabled="false" httpsGetEnabled="true"/> 
     <serviceDebug includeExceptionDetailInFaults="false"/> 
    </behavior> 
    </serviceBehaviors> 
</behaviors> 

我是否需要寫一個自定義證書驗證程序,因爲IIS Express生成自簽名證書?我試圖在沒有這樣做的情況下解決問題,因爲當我部署到IIS時,站點將配置證書頒發機構頒發的證書。

感謝您的任何幫助。

回答

3

從瀏覽IE的URL。您會看到網站安全證書存在問題的警告。按照what-do-i-need-to-do-to-get-ie8-to-accept-a-self-signed-certificate中的步驟操作。如果這是成功的,你可以得到該網站沒有得到在IE的警告,該WCFClient也將能夠得到它。

+0

更具體地說,從以下這個答案在amit_g指出到後這些方向。 http://stackoverflow.com/a/1412118/83658 – jpierson 2012-03-01 21:49:07