如何让带证书的WCF服务 部署在以network service 帐户运行的Windows Service中 原创

主要问题:
授权Network Service 帐户访问证书文件.
Install Service
安装WCF 服务
1.Import a server certification:

导入证书

Start=>Run mmc
开始=>运行mmc



File=>Add/Remove Snap-in
Certifications=>
文件=>添加删除管理单员


Certifications=>Add=>Computer Account
选择 证书=>添加=>计算机帐户


Right click on certification: All Task=>Import
Select the certification. Example: Create a test certification use MakeCert suppose server name is “dev01”
Start=>Programs=>Microsoft visual studio 2008=>visual studio tools=>visual studio command prompt (Right click run as administrator)
Run makecert.exe -sr LocalMachine -ss MY -a sha1 -n CN= dev01 -sky exchange –pe
(open mmc to see the certification)
2.Grant read purview to NETWORK SERVICE use FindPrivatekey tool to find the private key file store location of the certification imported just now.
For example (FindPrivatekey.exe in C:\) Open command prompt with administrator

From the picture above we can see that the private key file is in
F:\ProgramData\MicroSoft\Crypto\RSA\MachineKeys\ 1817c10fb6f21ea57a247b8d31ee9a0e_b0b895a9-b6c9-4147-a32c-d3e1c1659fa5 Open this folder:


Right click =>Properties=>Security=>Edit=>Add=>Advanced=>Find Now=>
Select NETWORK SERVIE =>Ok=>Uncheck Read & Execute => Ok


Notice: You can run a command instead of this action:
In Server 2008: ICacls F:\ProgramData\MicroSoft\Crypto\RSA\MachineKeys\1817c10fb6f21ea57a247b8d 31ee9a0e_b0b895a9-b6c9-4147-a32c-d3e1c1659fa5 /grant "NETWORK SERVICE":(R,WDAC)
In Server 2003: cacls.exe "C:\Documents and Settings\All Users\Application Data\Microsoft\Crypto\ RSA\MachineKeys\1817c10fb6f21ea57a247b8d\31ee9a0e_b0b895a9-b6c9-4147-a32c-d3e1c1659fa5 " /E /G "NETWORK SERVICE":R
3:Install

In Server 2003: cacls.exe "C:\Documents and Settings\All Users\Application Data\Microsoft\Crypto\ RSA\MachineKeys\1817c10fb6f21ea57a247b8d\31ee9a0e_b0b895a9-b6c9-4147-a32c-d3e1c1659fa5 " /E /G "NETWORK SERVICE":R

3:Install Service In Windows service Run Command prompt with administrator: Go to the install directory of dotnet framework For Example: The service host application is in C:\PlexusChartService\PlexusChartServiceHost.exe Run InstallUtil “C:\PlexusChartService\PlexusChartServiceHost.exe”


Now.It is run in network service account. Notice: Do not double click the certification to import the certification, In that case ,the private key file will be in the login user(administrator)’s folder.

转载于:https://www.cnblogs.com/CsharpFarmer/archive/2009/06/28/1512546.html

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值