原文链接http://blog.pluralsight.com/selfcert-create-a-self-signed-certificate-interactively-gui-or-programmatically-in-net
下载链接https://s3.amazonaws.com/pluralsight-free/keith-brown/samples/SelfCert.zip
该工具的使用方法http://www.codeproject.com/Articles/96028/WCF-Service-with-custom-username-password-authenti
Installing the certificate
Download the Pluralsight SelfCert from the link given at the beginning of the article. Run the tool as Administrator; otherwise, it will crash.
Configure the settings to install the certificate; refer the screen below.
After making the required changes, click the Save button and then you will see the screen below:
After the installation of the certificate, browse the site again, but this time, you should see a different error as shown in the screen below:
This error means that the default application pool does not have access rights to the certificate‘s private key, so now, we have to give read access to the default application pool to do this.
Download WinHttpCertCfg.exe from the link given at the beginning of the article. This tool is a command line tool. After installing the tool, run the following command on the command prompt as Administrator.
C:\Program Files (x86)\Windows Resource Kits\Tools>winhttpcertcfg -g -c LOCAL_MACHINE\My -s MyWebSite -a DefaultAppPool
但是这个命令执行会出错,提示No account information was found.
参考http://www.cnblogs.com/wuhuacong/archive/2012/07/09/2582297.html文章中的命令
C:\Program Files (x86)\Windows Resource Kits\Tools>winhttpcertcfg -g -c LOCAL_MACHINE\My -s MyWebSite -a "NETWORKSERVICE"
Microsoft (R) WinHTTP Certificate Configuration Tool
Copyright (C) Microsoft Corporation 2001.
Matching certificate:
CN=MyWebSite
Granting private key access for account:
NT AUTHORITY\NETWORK SERVICE
这样就可以正常访问了,但是不知道是不是会有其他的问题