读书人

|zyciis| WCF远程服务器https SSL 怎么

发布时间: 2012-09-04 14:19:30 作者: rapoo

|zyciis| WCF远程服务器https SSL 如何进行配置,谢谢 急
如,我是用VS2008SP1进行开发的,
宿主为IIS类型
我就直接新建了一个WCF WEB项目
然后就写完我的程序
再建立一个测试的Web Applocation项目进行测试
一切OK
-------------------------
然后我就把我的WCF项目放到服务器
然后配置好了SSL证书,和我本要测试用的客户端证书
最后运行提示:

提供的 URI 方案“https”无效;应为“http”。

服务器 Web.config

XML code
<?xml version="1.0"?><configuration>  <appSettings>  </appSettings>  <system.web>    <authentication mode="Windows"/>    <compilation debug="true"/>  </system.web>  <system.serviceModel>    <services>      <service behaviorConfiguration="CrmWCF.CRMBehavior" name="CrmWCF.CRM">        <endpoint address="" binding="wsHttpBinding" contract="CrmWCF.CRM">          <identity>            <dns value="localhost"/>          </identity>        </endpoint>        <endpoint address="mex" binding="mexHttpBinding" contract="IMetadataExchange"/>      </service>    </services>    <behaviors>      <serviceBehaviors>        <behavior name="CrmWCF.CRMBehavior">          <serviceMetadata httpGetEnabled="true"/>          <serviceDebug includeExceptionDetailInFaults="false"/>        </behavior>      </serviceBehaviors>    </behaviors>  </system.serviceModel></configuration>

客户端Web.config
XML code
 
<system.serviceModel>
<bindings>
<wsHttpBinding>
<binding name="WSHttpBinding_CRM" closeTimeout="00:01:00" openTimeout="00:01:00" receiveTimeout="00:10:00" sendTimeout="00:01:00" bypassProxyOnLocal="false"
transactionFlow="false" hostNameComparisonMode="StrongWildcard"
maxBufferPoolSize="524288" maxReceivedMessageSize="65536" messageEncoding="Text"
textEncoding="utf-8" useDefaultWebProxy="true" allowCookies="false">
<readerQuotas maxDepth="32" maxStringContentLength="8192" maxArrayLength="16384"
maxBytesPerRead="4096" maxNameTableCharCount="16384" />
<reliableSession ordered="true" inactivityTimeout="00:10:00"
enabled="false" />
<security mode="Message">
<transport clientCredentialType="Windows" proxyCredentialType="None"
realm="" />
<message clientCredentialType="Windows" negotiateServiceCredential="true"
algorithmSuite="Default" establishSecurityContext="true" />
</security>
</binding>
</wsHttpBinding>
</bindings>
<client>
<endpoint address="https://192.168.30.252/CRM.svc" binding="wsHttpBinding"
bindingConfiguration="WSHttpBinding_CRM" contract="CRM.CRM" name="WSHttpBinding_CRM">


<identity>
<dns value="localhost" />
</identity>
</endpoint>
<!-- <endpoint address="http://localhost:3187/CRM.svc" binding="wsHttpBinding"
bindingConfiguration="WSHttpBinding_CRM" contract="CRM.CRM" name="WSHttpBinding_CRM">
<identity>
<dns value="localhost" />
</identity>
</endpoint>-->
</client>
</system.serviceModel>


问:
主要是我现在用的是https 那么我申请的服务器证书名"192.168.30.252"和客户端WEB浏览证书"Jerry"
在这两个web.config中要怎么进行配置

谢谢


[解决办法]
你可以看看这个连接 也许对你有帮助 http://www.cnblogs.com/chnking/archive/2008/10/23/1318283.html

如果要修改 web.config 你可以<security mode="Transport">

WSHttpBinding绑定Transport安全模式,由传输层HTTPS保证消息的隐秘性和完整性。服务端必须有一个SSL证书,客户端必须信任服务端证书。
[解决办法]
修改证书认证类型

读书人网 >asp.net

热点推荐