1、首先需要安裝證書
到微軟官方下載winhttpcertcfg.exe
下載地址:http://www.microsoft.com/en-us/download/details.aspx?id=19801
使用說明:https://msdn.microsoft.com/en-us/library/aa384088.aspx#_using
選擇一個位置安裝即可,為了方便輸入,建議安裝到:C:\cert_tools\
2、安裝證書
安裝第一步的工具后,執行以下命令,即可安裝證書成功。
假如 證書工具安裝在C:\cert_tools\,證書放在 D:\Project\WechatASP
2.1、導入證書
C:\cert_tools\winhttpcertcfg -g -i "D:\Project\WechatASP\apiclient_cert.p12" -c LOCAL_MACHINE\My -a "Network Service" -p 微信商戶ID
如果成功會提示:
|
Microsoft (R) WinHTTP Certificate Configuration Tool
Copyright (C) Microsoft Corporation 2001.
Imported certificate:
SN=12xxxxxx
CN=<strong>有限公司
OU=MMPay
O=Tencent
L=Shenzhen
S=Guangdong
C=CN
|
2.2、設置 Network Serivce 擁有證書使用權限
C:\cert_tools\winhttpcertcfg -g -c LOCAL_MACHINE\My -s "MMPay" -a "Network Service"
如果成功會提示:
|
Microsoft (R) WinHTTP Certificate Configuration Tool
Copyright (C) Microsoft Corporation 2001.
Matching certificate:
SN=12xxxxxx
CN=<strong>有限公司
OU=MMPay
O=Tencent
L=Shenzhen
S=Guangdong
C=CN
Private key access has already been granted for account:
NT AUTHORITY\NETWORK SERVICE
|
2.3、設置 Everyone 擁有證書使用權限
C:\cert_tools\winhttpcertcfg -g -c LOCAL_MACHINE\My -s "MMPay" -a "EveryOne"
如果成功會提示:
|
Microsoft (R) WinHTTP Certificate Configuration Tool
Copyright (C) Microsoft Corporation 2001.
Matching certificate:
SN=12xxxxxx
CN=<strong>*有限公司
OU=MMPay
O=Tencent
L=Shenzhen
S=Guangdong
C=CN
Granting private key access for account:
\Everyone
|