使WCF Restful 向外提供https服务

1.先建一个WCF向外提供的Restful风格的服务项目(这里不是本文重点,在此不详述)web

2.安装IIS,导入安全证书,并让项目绑定到https安全

3.配置web.configcode

 3.1 在system.ServiceModel节点中添加以下节点xml

<bindings>
      <webHttpBinding >
        <binding name="SecureWebBinding" >
            <security mode="Transport">
              <transport clientCredentialType="None"></transport>
            </security>
        </binding>
      </webHttpBinding>
     </bindings>

上面注意 security 的 mode =“Transport” 而非 “None”it

3.2 而后在services节点中添加以下节点io

<!-- https start-->
        <endpoint address="" behaviorConfiguration="web" binding="webHttpBinding" bindingConfiguration="SecureWebBinding"
         contract="HeatNetworkMobileWcfService.IService"  />
        <endpoint address="mex" binding="mexHttpsBinding" contract="IMetadataExchange"/>
        <!-- https end-->

最终修改部分以下class

到此为止配置搞定cli

相关文章
相关标签/搜索