1.先建一个WCF向外提供的Restful风格的服务项目(这里不是本文重点,在此不详述)
2.安装IIS,导入安全证书,并让项目绑定到https
3.配置web.config
3.1 在system.ServiceModel节点中添加如下节点
<bindings>
<webHttpBinding >
<binding name="SecureWebBinding" >
<security mode="Transport">
<transport clientCredentialType="None"></transport>
</security>
</binding>
</webHttpBinding>
</bindings>
上面注意 security 的 mode =“Transport” 而非 “None”
3.2 然后在services节点中添加如下节点
<!-- https start-->
<endpoint address="" behaviorConfiguration="web" binding="webHttpBinding" bindingConfiguration="SecureWebBinding"
contract="HeatNetworkMobileWcfService.IService" />
<endpoint address="mex" binding="mexHttpsBinding" contract="IMetadataExchange"/>
<!-- https end-->
最终修改部分如下
到此为止配置搞定