title: The incorrect localhost certificate is being served by IIS
body: <p>OK I have a SSL issue that I can't seem to get past on this 1 Win7 x64 machine. I have been using self-signed certs for years and even blogged about them before so I have experience. However something is happening that I can't figure out this time.</p>
  
  <p>I have (2) localhost SSL certs created and insalled on my machine.</p>
  
  <ol>
  <li>localhost (friendly name) issued and created in IIS (7.5). It contains the 'Issued To' and 'Issued By' values of my machine name: 'DevMachine123'. This is the certificate being served up for applications configured under the 'Default Web Site' in IIS.</li>
  <li>localhost SSL certificate created using makecert.exe tool where CN=localhost (common name) was used. It contains the 'Issued To' and 'Issued By' values of 'localhost'. This is the SSL cert I <em>want</em> served up in IIS for my applications configured under  the 'Default Web Site'.</li>
  </ol>
  
  <p>The error I'm getting is: </p>
  
  <blockquote>
    <p>'The security certificate presented by this website was issued for a
    different website's address.'</p>
  </blockquote>
  
  <p>When I view the certificate being served up from the IE browser: it shows the localhost cert issued to 'DevMachine123' is being used and <em>not</em> the localhost issued to localhost (#2 above) which should resolve this issue. Hence the name mismatch because 'DevMachine123' does not match 'localhost'.</p>
  
  <p>Another point to make; my certificates <em>have</em> been added to 'Trusted Root Certification Authorities' so they <em>both are trusted certificates</em>.</p>
  
  <p>Last point to make, I checked the https port 443 Binding configuration for the 'Default Web Site' on my machine in IIS. I view the certificate and it shows the <em>correct</em> localhost certificate is bound (#2 above with CN=localhost).</p>
  
  <p>I feel that I have covered my bases here (yes I have seen <a href="http://www.sslshopper.com/article-how-to-create-a-self-signed-certificate-in-iis-7.html" rel="noreferrer">this</a> and <a href="http://www.hanselman.com/blog/WorkingWithSSLAtDevelopmentTimeIsEasierWithIISExpress.aspx" rel="noreferrer">this</a> so please do not re-post). What am I missing here?</p>
  
  <p>Thanks!</p>