wsHttpBindingを使用してWCFサービスをホストしようとしています。makecertを使用して証明書を作成し、web.configにいくつかの行を追加しました。
これは私が得ているエラーです:
System.ArgumentException: The certificate 'CN=WCfServer' must have a private key that is capable of key exchange. The process must have access rights for the private key.
グーグルアップすると、証明書ファイルのアクセス権に問題があるようです。caclsを使用して、NETWORK SERVICEとユーザー名に読み取り権限を付与しましたが、何も変更されませんでした。
また、証明書ファイルのプロパティのセキュリティ設定に移動し、ネットワークサービスとユーザー名を完全に制御しました。再び無駄に。
問題が何であるか、そして私が正確に何をする必要があるかについて私を導くことができますか?私はこれらの証明書のことで本当に不安定です。
これが私のweb.configです。
<system.serviceModel>
<services>
<service name="Abc.Service" behaviorConfiguration="Abc.ServiceBehavior">
<endpoint address="" binding="wsHttpBinding" bindingConfiguration="Abc.BindConfig" contract="Abc.IService">
<identity>
<dns value="localhost"/>
</identity>
</endpoint>
<endpoint address="mex" binding="mexHttpBinding" contract="IMetadataExchange"/>
</service>
</services>
<behaviors>
<serviceBehaviors>
<behavior name="Abc.ServiceBehavior">
<serviceMetadata httpGetEnabled="true"/>
<serviceDebug includeExceptionDetailInFaults="false"/>
<serviceCredentials>
<clientCertificate>
<authentication certificateValidationMode="PeerTrust"/>
</clientCertificate>
<serviceCertificate findValue="WCfServer" storeLocation="CurrentUser" storeName="My" x509FindType="FindBySubjectName" />
</serviceCredentials>
</behavior>
</serviceBehaviors>
</behaviors>
<bindings>
<wsHttpBinding>
<binding name="Abc.BindConfig">
<security mode="Message">
<message clientCredentialType="Certificate" />
</security>
</binding>
</wsHttpBinding>
</bindings>
</system.serviceModel>