IIS 7.5でホストされているASP.NET Webアプリケーションで呼び出す必要があるWCFサービスがあります。このWCFサービスは、クライアント証明書でトランスポートセキュリティを使用します。私は "ローカルコンピュータ/個人"ストアの場所にmmcを使用してインストールしたクライアント証明書が提供されています。 .pfxは、プライベートキーを持つクライアント証明書のCAである2つの他の証明書(秘密キーなし)をインストールしました。私は将来、同じWebサービスで使用される他の証明書を持っている可能性があるため、実行時に証明書を割り当てています。私は、すべてのクライアント証明書を渡していなかったかのように私のWebアプリケーションは、Webサービスを呼び出すApplicationPoolIdentityの下で実行するためのIIS 7.5でホストされているASP.NETアプリケーションのWCFクライアント証明書の問題
wcfClient.ClientCredentials.ClientCertificate.SetCertificate(StoreLocation.LocalMachine, StoreName.My, X509FindType.FindBySerialNumber, "XXXXXXXXXXXXXXXXXXXXXX");
// debugging shows that client certificate was found
var result = wcfClient.CallMyMethod();
は(403禁止)インナーWebExceptionでMessageSecurityExceptionをスローします。実際に有効な証明書を設定しない場合は、構成が要求する場合はInvalidOperationExceptionが発生します。管理者アカウントで実行すると、例外はスローされません。私はApplicationPoolIdentityの下でwebserviceを呼び出すことができる必要があります。 >すべてのタスクは、 - - >プライベートキーの管理MyCertificate:
編集:
MMCで- を:私は、私がこれまで試してみました何
...証明書チェーンは、ここで問題になるかもしれないと思います。 ..私はCのためにIIS_IUSRSへの読み取りアクセス権をIIS_IUSRS
- 追加した秘密鍵を管理するための許可を与えた:\はProgramData \マイクロソフト\暗号化\ RSAは
- 私はトレースSystem.Netを使用してきましたし、私はApplicationPoolIdentityのログを比較しました私の管理者アカウント。 「我々は、ユーザー提供の証明書を持っています。サーバーは、発行体のいずれかに一致する証明書を探しています。24発行者(複数可)を指定している。」の後にすべては、以下の特定のポイントまで同じに見えるラインを
ApplicationPoolIdentityログ:
System.Net Information: 0 : [5436] InitializeSecurityContext(In-Buffers count=2, Out-Buffer length=0, returned code=CredentialsNeeded).
System.Net Information: 0 : [5436] SecureChannel#20350898 - We have user-provided certificates. The server has specified 24 issuer(s). Looking for certificates that match any of the issuers.
System.Net Information: 0 : [5436] SecureChannel#20350898 - Left with 0 client certificates to choose from.
System.Net Information: 0 : [5436] Using the cached credential handle.
System.Net Information: 0 : [5436] InitializeSecurityContext(credential = System.Net.SafeFreeCredential_SECURITY, context = fc5d070:1ffd1d0, targetName = ws.allianztiriac.ro, inFlags = ReplayDetect, SequenceDetect, Confidentiality, AllocateMemory, InitManualCredValidation)
System.Net Information: 0 : [5436] InitializeSecurityContext(In-Buffers count=2, Out-Buffer length=349, returned code=ContinueNeeded).
System.Net Information: 0 : [5436] InitializeSecurityContext(credential = System.Net.SafeFreeCredential_SECURITY, context = fc5d070:1ffd1d0, targetName = ws.allianztiriac.ro, inFlags = ReplayDetect, SequenceDetect, Confidentiality, AllocateMemory, InitManualCredValidation)
System.Net Information: 0 : [5436] InitializeSecurityContext(In-Buffers count=2, Out-Buffer length=0, returned code=ContinueNeeded).
System.Net Information: 0 : [5436] InitializeSecurityContext(credential = System.Net.SafeFreeCredential_SECURITY, context = fc5d070:1ffd1d0, targetName = ws.allianztiriac.ro, inFlags = ReplayDetect, SequenceDetect, Confidentiality, AllocateMemory, InitManualCredValidation)
System.Net Information: 0 : [5436] InitializeSecurityContext(In-Buffers count=2, Out-Buffer length=0, returned code=OK).
System.Net Information: 0 : [5436] Remote certificate: [bla bla remote certificate]
System.Net Information: 0 : [5436] SecureChannel#20350898 - Remote certificate was verified as valid by the user.
Adminアカウントログ:アイデアとして
System.Net Information: 0 : [5952] InitializeSecurityContext(In-Buffers count=2, Out-Buffer length=0, returned code=CredentialsNeeded).
System.Net Information: 0 : [5952] SecureChannel#60080036 - We have user-provided certificates. The server has specified 24 issuer(s). Looking for certificates that match any of the issuers.
System.Net Information: 0 : [5952] SecureChannel#60080036 - Selected certificate: [Bla bla bla client cert info]
System.Net Information: 0 : [5952] SecureChannel#60080036 - Left with 1 client certificates to choose from.
System.Net Information: 0 : [5952] SecureChannel#60080036 - Trying to find a matching certificate in the certificate store.
System.Net Information: 0 : [5952] SecureChannel#60080036 - Locating the private key for the certificate: [Bla bla bla client cert info]
System.Net Information: 0 : [5952] SecureChannel#60080036 - Certificate is of type X509Certificate2 and contains the private key.
System.Net Information: 0 : [5952] AcquireCredentialsHandle(package = Microsoft Unified Security Protocol Provider, intent = Outbound, scc = System.Net.SecureCredential)
System.Net Information: 0 : [5952] InitializeSecurityContext(credential = System.Net.SafeFreeCredential_SECURITY, context = 4e5bb48:1fff710, targetName = ws.allianztiriac.ro, inFlags = ReplayDetect, SequenceDetect, Confidentiality, AllocateMemory, InitManualCredValidation)
System.Net Information: 0 : [5952] InitializeSecurityContext(In-Buffers count=2, Out-Buffer length=5718, returned code=ContinueNeeded).
System.Net Information: 0 : [5952] InitializeSecurityContext(credential = System.Net.SafeFreeCredential_SECURITY, context = 4e5bb48:1fff710, targetName = ws.allianztiriac.ro, inFlags = ReplayDetect, SequenceDetect, Confidentiality, AllocateMemory, InitManualCredValidation)
System.Net Information: 0 : [5952] InitializeSecurityContext(In-Buffers count=2, Out-Buffer length=0, returned code=ContinueNeeded).
System.Net Information: 0 : [5952] InitializeSecurityContext(credential = System.Net.SafeFreeCredential_SECURITY, context = 4e5bb48:1fff710, targetName = ws.allianztiriac.ro, inFlags = ReplayDetect, SequenceDetect, Confidentiality, AllocateMemory, InitManualCredValidation)
System.Net Information: 0 : [5952] InitializeSecurityContext(In-Buffers count=2, Out-Buffer length=0, returned code=OK).
System.Net Information: 0 : [5952] Remote certificate: [bla bla bla remote certificate]
ここで説明した手順を試しましたか[リンク](http://serverfault.com/questions/131046/how-to-grant-iis-7-5-access-to-a-certificate-in-certificate-格納)? – Hans
私はmmcを使用して許可を与えました.IISは証明書の秘密鍵をフルコントロールしています。証明書は送信されません。私は、クライアント証明書を使用する別のWebサービスを持っていて、ApplicationPoolIdentity上で動作しているものは問題ありません。 – Vasea