WCF在https类型的网站中,web.config文件的配置方法。

关键是加粗的两行。

<system.serviceModel>
  <behaviors>
   <serviceBehaviors>
    <behavior name="BOAutoApprovalWCFBehavior">
     <serviceMetadata httpsGetEnabled="true" />
     <serviceDebug includeExceptionDetailInFaults="false" />
    </behavior>
   </serviceBehaviors>
  </behaviors>
  <services>
   <service behaviorConfiguration="BOAutoApprovalWCFBehavior" name="BOAutoApprovalWCF">
    <endpoint address="" binding="wsHttpBinding" bindingConfiguration="TransportSecurity"
     contract="IBOAutoApprovalWCF">
     <identity>
      <dns value="localhost" />
     </identity>
    </endpoint>
    <endpoint address="mex" binding="mexHttpsBinding" contract="IMetadataExchange" />
   </service>
  </services>
   <bindings>
     <wsHttpBinding>
       <binding name="TransportSecurity">
         <security mode="Transport">
           <transport clientCredentialType="None" />
         </security>
       </binding>
     </wsHttpBinding>
   </bindings>
 </system.serviceModel>

posted on 2011-12-12 17:05  BobLiu  阅读(2037)  评论(1编辑  收藏  举报