WCF - Certificate based authorization from a web app
I have a WCF service to which access is only granted to a few machines that have a known certificate, and to a web app.
For the web app, I need to specify the certificate to use for authorization:
<behaviors>
<endpointBehaviors>
<behavior name="ScannerManagerBehavior">
<clientCredentials>
<clientCertificat开发者_运维知识库e findValue="MyCertificateName" x509FindType="FindBySubjectName" storeLocation="CurrentUser" storeName="My"/>
<serviceCertificate>
<authentication certificateValidationMode="PeerTrust"/>
</serviceCertificate>
</clientCredentials>
</behavior>
</endpointBehaviors>
</behaviors>
The problem is that the web app isn't running under the user account for which the certificate is registered. To get round it in dev mode I changed the app pool to run under my user identity, but that's a temp. solution.
Should I install the certificate for the "Network Service" user account (if you can do that), specify a different source for the certificate, or is there a better way to solve this problem?
Thanks!
Install the certificate in the LocalMachine store rather than the current user store - you can then pick it up from there by changing the storeLocation in the clientCertificate element
精彩评论