1,生成加密证书
用VisualStudio 中 MakeCert.exe
的工具生成加密证书。
MakeCert.exe -sr localmachine -ss My -n CN=localhost,OU=https://localhost -sky exchange -pe -r localhost.cer
2,查看生成好的加密证书的『Thumbprint hash』
3,用 httpcfg
命令将加密证书和SSL端口关联好。
关联 httpcfg set ssl -i [ip]:[port] -h [thumbprint hash]
解除关联 httpcfg delete ssl –i [ip]:[port]
C:\Documents and Settings\Administrator>httpcfg query ssl
C:\Documents and Settings\Administrator>httpcfg set ssl -i 0.0.0.0:10180 -h 59ab8e12f1dbf43060684932c1bb570874049c09
HttpSetServiceConfiguration completed with 0.
C:\Documents and Settings\Administrator>httpcfg query ssl
IP : 0.0.0.0:10180
Hash : 59ab8e12f1dbf43060684932c1bb57 874 49c 9
Guid : {00000000-0000-0000-0000-000000000000}
CertStoreName : (null)
CertCheckMode : 0
RevocationFreshnessTime : 0
UrlRetrievalTimeout : 0
SslCtlIdentifier : (null)
SslCtlStoreName : (null)
Flags : 0
------------------------------------------------------------------------------
C:\Documents and Settings\Administrator>
4,用 httpcfg
命令设定 URLACL
C:\Documents and Settings\Administrator>httpcfg.exe set urlacl /u https://+:10184/webapp/sample1 /a "D:(A;;GX;;;NS)"
HttpSetServiceConfiguration completed with 0.
C:\Documents and Settings\Administrator>httpcfg.exe set urlacl /u https://+:10184/webapp/sample2 /a "D:(A;;GX;;;NS)"
HttpSetServiceConfiguration completed with 0.
C:\Documents and Settings\Administrator>httpcfg query urlacl
URL : http://+:80/Temporary_Listen_Addresses/
ACL : D:(A;;GX;;;WD)
------------------------------------------------------------------------------
URL : https://+:10184/webapp/sample1/
ACL : D:(A;;GX;;;NS)
------------------------------------------------------------------------------
URL : https://+:10184/webapp/sample2/
ACL : D:(A;;GX;;;NS)
------------------------------------------------------------------------------
C:\Documents and Settings\Administrator>
5,修改WCF的配置文件
<system.serviceModel>
<bindings >
<basicHttpBinding>
<binding name ="myBasicBinding">
<security mode ="Transport">
<transport clientCredentialType="None"/>
</security>
</binding>
</basicHttpBinding>
</bindings>
<services>
<service name="net.dncsoft.sample1" behaviorConfiguration="sample1Behavior">
<endpoint address="https://localhost:10184/webapp/sample1"
contract="net.dncsoft.Isample1"
binding="basicHttpBinding"
bindingNamespace="http://www.dncsoft.net/2011/11/sample"
bindingConfiguration="myBasicBinding" />
</service>
<service name="net.dncsoft.sample2" behaviorConfiguration="sample2Behavior">
<endpoint address="https://localhost:10184/webapp/sample2"
contract="net.dncsoft.Isample2"
binding="basicHttpBinding"
bindingNamespace="http://www.dncsoft.net/2011/11/sample"
bindingConfiguration="myBasicBinding" />
</service>
</services>
<behaviors>
<serviceBehaviors>
<behavior name="sample1Behavior">
<serviceMetadata httpsGetEnabled="true" httpGetEnabled="false"
httpsGetUrl="https://localhost:10184/webapp/sample1"/>
</behavior>
<behavior name="sample2Behavior">
<serviceMetadata httpsGetEnabled="true" httpGetEnabled="false"
httpsGetUrl="https://localhost:10184/webapp/sample2"/>
</behavior>
</serviceBehaviors>
</behaviors>
</system.serviceModel>
- 大小: 311.8 KB
分享到:
相关推荐
“双工”示例演示如何定义和实现双工协定。 当客户端与服务建立会话并为服务提供可用来将消息发送回客户端的通道时,就会发生双工通信。
勾选“Web服务器(IIS)”,“应用程序服务器”弹出是否添加Web服务器(IIS)所需的功能、IIS支持功能。点击“添加必需的功能”所回到角色向导 6. 6 Windows 进程激活服务,Windows 进程激活服务通过删除对HTTP 的...
memberReaderClass 设定一个成员读取器,默认情况下 Hierarchy 都是从关系型数据库里读取的,如果你的数据不在 RDBMS 里面的话,你可以通过自定义一个 member reader 来表现一个 Hierarchy 。 3.5. Level 级别 , ...