MSDNを無駄にしてしまった後、数え切れないほどの記事やSO - 私はまだ何日間も闘争を見せていません。WCF wsHttpBinding証明書セキュリティ交渉例外
だから私はこのている:リモートエンドポイントでのセキュリティネゴシエーションが失敗したため、WCFサービスは、クライアントによって消費される必要があり、私はちょうどSecurityNegotiationException
を打つセキュアチャネルを維持開くことができません。これは、チャネルの作成に使用されたEndpointAddressにEndpointIdentityが指定されていないか、間違って指定されている可能性があります。 EndpointAddressによって指定または暗黙指定されたEndpointIdentityがリモートエンドポイントを正しく識別していることを確認してください。
私はこのエラーをネット全体で見てきましたが、誰も私の正確なシナリオを考えていないようです(実行可能な回答は少なくともあります)。
My GenericIntegration(WCFサービス)は証明書で認証されたwsHttpBinding(メッセージモード)を使用します(私は非常にカスタムのユーザー名/パスワード認証+認証クラスは設計上のパラメータとして渡されます)、セキュリティ対策の裏付けはありません。
ホストのコンフィグ
<system.serviceModel>
<bindings>
<wsHttpBinding>
<binding name="wsHttpEndpintBinding">
<security mode ="Message">
<message clientCredentialType="Certificate" establishSecurityContext="false" negotiateServiceCredential="false"/>
</security>
</binding>
</wsHttpBinding>
</bindings>
<services>
<service behaviorConfiguration="wsHttpBehaviour" name="GenericIntegration.GenericService">
<endpoint address="mex" binding="mexHttpBinding" contract="IMetadataExchange"/>
<endpoint address="" binding="wsHttpBinding" bindingConfiguration="wsHttpEndpintBinding"
name="wsHttpEndpoint" contract="GenericIntegration.GenInterface" />
<host>
<baseAddresses>
<!--<add baseAddress="http://localhost:59082/GenericService.svc" />-->
</baseAddresses>
</host>
</service>
</services>
<behaviors>
<serviceBehaviors>
<behavior name="wsHttpBehaviour">
<serviceMetadata httpGetEnabled="true" />
<serviceDebug includeExceptionDetailInFaults="true" />
<serviceCredentials>
<clientCertificate>
<certificate findValue="GenIntegrationClient" storeName="My" storeLocation="LocalMachine" x509FindType="FindBySubjectName" />
<authentication certificateValidationMode="PeerTrust" />
</clientCertificate>
<serviceCertificate findValue="GenIntegrationClient" storeLocation="LocalMachine" storeName="My" x509FindType="FindBySubjectName" />
</serviceCredentials>
</behavior>
<behavior name="metadataBehavior">
<serviceMetadata httpGetEnabled="true" />
<serviceDebug includeExceptionDetailInFaults="true" />
</behavior>
</serviceBehaviors>
</behaviors>
<serviceHostingEnvironment multipleSiteBindingsEnabled="true" />
とクライアントのconfig証明書(およびはい、これが唯一のテストのためである)について今
<system.serviceModel>
<behaviors>
<endpointBehaviors>
<behavior name="endpointBehaviour">
<clientCredentials>
<clientCertificate findValue="GenIntegrationClient" storeLocation="LocalMachine" storeName="My"
x509FindType="FindBySubjectName" />
<serviceCertificate>
<authentication certificateValidationMode="PeerTrust" revocationMode="NoCheck"/>
</serviceCertificate>
</clientCredentials>
</behavior>
</endpointBehaviors>
</behaviors>
<bindings>
<wsHttpBinding>
<binding name="wsHttpEndpoint" maxBufferPoolSize="20000000" maxReceivedMessageSize="20000000">
<security mode="Message">
<message clientCredentialType="Certificate" />
</security>
</binding>
</wsHttpBinding>
</bindings>
<client>
<endpoint address="http://localhost:59082/GenericService.svc"
binding="wsHttpBinding" bindingConfiguration="wsHttpEndpoint" behaviorConfiguration="endpointBehaviour"
contract="GenService.GenInterface" name="wsHttpEndpoint">
<identity>
<certificate encodedValue="AwAAAAEAAAAUAAAAKdyUELIKMtdh2MFsYQ09ja+vyeEgAAAAAQAAACICAAAwggIeMIIBi6ADAgECAhCFBfF1EXQZhkPKaBpQCl84MAkGBSsOAwIdBQAwJDEiMCAGA1UEAxMZNE1PU1RHZW5JbnRlZ3JhdGlvblNlcnZlcjAeFw0xNjA3MjgxNDQ5MjVaFw0zOTEyMzEyMzU5NTlaMCQxIjAgBgNVBAMTGTRNT1NUR2VuSW50ZWdyYXRpb25DbGllbnQwgZ8wDQYJKoZIhvcNAQEBBQADgY0AMIGJAoGBAIwsIlz5nZ3HxeYofTpYKr6RcfQMe/jZxPuHcljT+8pBOZ6KmYcyxeRTO074yP6yF8b1IqFskII+qqmCT8nDsb8xdo5Ee0oqL1LKR+xeTgg2ZXXoocxqR1AdxWFVdlMxMSjKIEGE+MnSDdB6vgXahhpUbAS7cdrNoAFKNIz+vrt1AgMBAAGjWTBXMFUGA1UdAQROMEyAEB4cu6OjBqQHct6przmowGyhJjAkMSIwIAYDVQQDExk0TU9TVEdlbkludGVncmF0aW9uU2VydmVyghD75YH5y52zsU5wcmZLJzPiMAkGBSsOAwIdBQADgYEA2BinUmEfgZKcb1qFD1T5ajc2OWHGLjDLpDi8Y7amM4P3rFGvelx7NmCNUH88iGS9LcbDsmY59HcZwUavtPOr4LMRDhl+5YuGht1fIYEk8QSDIhjevijgDOIVBBAeNIA8tva1faMNtYnFXsj0VxMvlrZ4exeKFVFjv2sib5YNFxY=" />
</identity>
</endpoint>
</client>
</system.serviceModel>
:GenIntegrationServer。セークライアント証明書に署名するための秘密鍵を持つ自己署名付きCAルート証明書として作成されます。 GenIntegrationServer証明書とGenIntegrationClient証明書の両方がmakecertで生成されました。クライアント証明書は秘密鍵にリンクされており、個人ストアに正しくインストールされています。
私はまだ証明書、秘密鍵、安全な通信に新しいです。私は間違いを犯す場所を単純に理由付けることはできません。この方法で証明書を使用することについてあまりにも多くの投稿を見つけられませんでした。
私はこれ以上の髪を失うか寝る前に誰でも助けてもらえますか?要求ごととして
UPDATE
、私はログを追加しました。しかし、彼らが明らかにしている最大のものは次のとおりです。
悲しいことに、なぜセキュリティ検証に失敗したのかまだ分かりません。何か案は?
詳細なログ用にサービスクライアントとホストを構成します(https://msdn.microsoft.com/en-us/library/ms733025(v=vs.110).aspx)。これにより、交渉が失敗したときに内部的に何がうまくいかないのかがわかります。この情報を使用して問題を解決するか、詳細情報を入手した後で具体的な質問をしてください。 – asawyer
また、私がセットアップで持っていた共通の問題は、IISサービスアカウントに秘密鍵の読み取りアクセス権がないことです。 WSE3.0ツールをインストールし、証明書ツールを使用して秘密鍵のアクセス許可を与えます。 – asawyer
要求ごとのログを追加しました。私は結果を使って質問を編集します。 – Medismal