[英]Trouble adding service reference to WCF service hosted in IIS Express with SSL
我在Visual Studio 2010中的IIS Express中托管了一個普通的WCF服務.IIS Express配置為使用SSL。
在切換到SSL之前,我沒有遇到任何問題,但現在我無法更新是為我的WCF服務添加服務引用(這只是一個普通的IIS托管的svc文件)。
當我使用WCFTestClient時,我得到一個更有用的錯誤:
錯誤:無法從https:// localhost:44302 / Services / TrueChecksService.svc獲取元數據如果這是您有權訪問的Windows(R)Communication Foundation服務,請檢查您是否已在指定地址啟用元數據發布。 有關啟用元數據發布的幫助,請參閱MSDN文檔, 網址為http://go.microsoft.com/fwlink/?LinkId=65455 .WS-元數據交換錯誤URI: https:// localhost:44302 / Services / TrueChecksService.svc元數據包含無法解析的引用:'https:// localhost:44302 / Services / TrueChecksService.svc'。 無法與權限“localhost:44302”建立SSL / TLS安全通道的信任關系。 底層連接已關閉:無法為SSL / TLS安全通道建立信任關系。 根據驗證程序,遠程證書無效.HTTP GET錯誤URI: https:// localhost:44302 / Services / TrueChecksService.svc下載“https:// localhost:44302 / Services / TrueChecksService.svc”時出錯。 底層連接已關閉:無法為SSL / TLS安全通道建立信任關系。 根據驗證程序,遠程證書無效。
這是我目前的配置:
<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時,該站點將配置一個由證書頒發機構頒發的證書。
謝謝你的幫助。
從IE瀏覽URL。 您會看到網站安全證書存在問題的警告。 按照“ 我需要做什么”來獲取ie8接受自簽名證書的步驟 。 如果成功並且您可以在IE中未獲得該警告的情況下訪問該站點,WCFClient也可以訪問它。
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.