title: IIS7 can't find X.509 certificate, even though self-hosting WCF can
body: <p>I'm trying to host WCF service in IIS7. Everything worked fine until I've specified the following in web.config file:</p>
  
  <pre><code>    &lt;serviceCredentials&gt;
        &lt;serviceCertificate findValue="MyCert"
                            storeLocation="CurrentUser"
                            storeName="My"
                            x509FindType="FindBySubjectName" /&gt;
      &lt;/serviceCredentials&gt; 
  </code></pre>
  
  <p>Then I get an exception <em>System.InvalidOperationException: Cannot find the X.509 certificate using the following search criteria: StoreName 'My', StoreLocation 'CurrentUser', FindType 'FindBySubjectName', FindValue ‘MyCert’</em>.</p>
  
  <p>BTW - I'm using this same certificate ( stored at the same location ) with self-hosting WCF service without any problems.</p>