使用SSL的IIS下WCF配置(CSDN手動遷移)

來源:互聯網
上載者:User

標籤:

在WCF的WebConfig配置http綁定,並設定為使用傳輸安全性,如下所示

1     <bindings>2       <basicHttpBinding>3         <binding name="secureHttpBinding">4           <security mode="Transport">5             <transport clientCredentialType="None"/>6           </security>7         </binding>8       </basicHttpBinding>9     </bindings>

指定服務和服務端點

1     <services>  2       <service name="WCF.Service" >  3         <endpoint contract="WCF.IService" address="" binding="basicHttpBinding" bindingConfiguration="secureHttpBinding"></endpoint>  4         <endpoint address="mex" binding="mexHttpsBinding" contract="IMetadataExchange" /><!--這裡為固定寫法-->  5       </service>  6     </services> 

完整WebConfig如下:

 1 <?xml version="1.0" encoding="utf-8"?>   2 <configuration>   3    4   <system.web>   5     <compilation targetFramework="4.0" />   6   </system.web>   7   <system.serviceModel>   8    9     <bindings>  10       <basicHttpBinding>  11         <binding name="secureHttpBinding">  12           <security mode="Transport">  13             <transport clientCredentialType="None"/>  14           </security>  15         </binding>  16       </basicHttpBinding>  17     </bindings>  18       19     <services>  20       <service name="WCF.Service" >  21         <endpoint contract="WCF.IService" address="" binding="basicHttpBinding" bindingConfiguration="secureHttpBinding"></endpoint>  22         <endpoint address="mex" binding="mexHttpsBinding" contract="IMetadataExchange" /><!--這裡為固定寫法-->  23       </service>  24     </services>  25   26     <behaviors>  27       <serviceBehaviors>  28         <behavior>  29           <!-- 為避免泄漏中繼資料資訊,請在部署前將以下值設定為 false -->  30           <serviceMetadata httpsGetEnabled="true" />  31           <!-- 要接收故障異常詳細資料以進行調試,請將以下值設定為 true。在部署前設定為 false 以避免泄漏異常資訊 -->  32           <serviceDebug includeExceptionDetailInFaults="false" />  33         </behavior>  34       </serviceBehaviors>  35     </behaviors>  36       37     <serviceHostingEnvironment multipleSiteBindingsEnabled="true" />  38   </system.serviceModel>  39   <system.webServer>  40     <modules runAllManagedModulesForAllRequests="true" />  41     <!--  42         若要在調試過程中瀏覽 Web 應用程式根目錄,請將下面的值設定為 True。  43         在部署之前將該值設定為 False 可避免泄露 Web 應用程式檔案夾資訊。  44       -->  45     <directoryBrowse enabled="true" />  46   </system.webServer>  47   48 </configuration>  

 

使用SSL的IIS下WCF配置(CSDN手動遷移)

聯繫我們

該頁面正文內容均來源於網絡整理,並不代表阿里雲官方的觀點,該頁面所提到的產品和服務也與阿里云無關,如果該頁面內容對您造成了困擾,歡迎寫郵件給我們,收到郵件我們將在5個工作日內處理。

如果您發現本社區中有涉嫌抄襲的內容,歡迎發送郵件至: info-contact@alibabacloud.com 進行舉報並提供相關證據,工作人員會在 5 個工作天內聯絡您,一經查實,本站將立刻刪除涉嫌侵權內容。

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.