首页 诗词 字典 板报 句子 名言 友答 励志 学校 网站地图
当前位置: 首页 > 教程频道 > 开发语言 > 编程 >

使WCF服务支持HTTPS的设定步骤 (客户篇)

2012-12-24 
使WCF服务支持HTTPS的设定方法 (客户篇)1,客户端配置文件?xml version1.0 encodingutf-8?configu

使WCF服务支持HTTPS的设定方法 (客户篇)

1,客户端配置文件

<?xml version="1.0" encoding="utf-8"?><configuration>  <system.serviceModel>    <bindings>      <basicHttpBinding>        <binding name="Sample_SSL" closeTimeout="00:01:00"            openTimeout="00:01:00" receiveTimeout="00:10:00" sendTimeout="00:01:00"            allowCookies="false" bypassProxyOnLocal="false" hostNameComparisonMode="StrongWildcard"            maxBufferSize="65536" maxBufferPoolSize="524288" maxReceivedMessageSize="65536"            messageEncoding="Text" textEncoding="utf-8" transferMode="Buffered"            useDefaultWebProxy="true">          <readerQuotas maxDepth="32" maxStringContentLength="8192" maxArrayLength="16384"              maxBytesPerRead="4096" maxNameTableCharCount="16384" />          <security mode="Transport">            <transport clientCredentialType="None" proxyCredentialType="None"                realm="" />            <message clientCredentialType="UserName" algorithmSuite="Default" />          </security>        </binding>      </basicHttpBinding>    </bindings>    <client>      <endpoint address="https://localhost:10184/webapp/sample" binding="basicHttpBinding"                bindingConfiguration="Sample_SSL" contract="SamplePortType"                name="SamplePort_SSL" />    </client>  </system.serviceModel></configuration>

?

2,在程序中取消对加密证书的检查。

ServicePointManager.ServerCertificateValidationCallback += new RemoteCertificateValidationCallback((sender, certificate, chain, policyErrors) => { return true; });
?

?

?

?

热点排行