How can I deploy a certificate-carrying WCF Service in a Windows Service running in a network service account?

Source: Internet
Author: User

Main problems:
Authorize the network service account to access the Certificate file.
Install Service
Install the WCF Service
1. Import a server certification:

Import Certificate

Start => RUN MMC
Start => RUN MMC


File => Add/Remove snap-in
Certifications =>
File => add or delete a manager


Certifications => Add => Computer Account
Select certificate => 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 \ Encrypt 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 incubator/Grant "Network Service" :( R, wdac)
In Server 2003: cacls.exe "C: \ Documents ents and Settings \ All Users \ Application Data \ Microsoft \ crypto \ RSA \ machinekeys \ 1817c10fb6f21ea57a247b8d \ Users"/e/g "Network Service ": R
3: Install

In Server 2003: cacls.exe "C: \ Documents ents and Settings \ All Users \ Application Data \ Microsoft \ crypto \ RSA \ machinekeys \ 1817c10fb6f21ea57a247b8d \ Users"/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.

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.