WCF service with Ssl Certificate in Azure emulator

2019-08-30 00:17发布

问题:

I have setup my my cloud using the following http://azure.microsoft.com/en-us/documentation/articles/cloud-services-configure-ssl-certificate/

and the web role using the following http://msdn.microsoft.com/en-us/library/ms731074%28v=vs.110%29.aspx

My problem that when I use emulator I get an error That the there is a name mismatch between a certificate and the website in this case(127.0.0.1) What can be done to solve it.

回答1:

So there are two approaches you could take:

  1. Create a separate cloud project for each environment - This way you could create a self-signed certificate for your development environment and live with the warning that the certificate is not trusted.
  2. Get a wildcard certificate for your application - This is the approach we have taken for our application (along with the 1st one). Basically we took a wildcard SSL certificate and used that certificate in our application. Then we added an entry in hosts file located in C:\Windows\System32\drivers\etc like this:

127.0.0.1 dev.cloudportam.com

Next, we added hosts header in our dev cloud project's csdef file.

<Sites>
  <Site name="Web">
    <Bindings>
      <Binding name="Endpoint1" endpointName="Endpoint1" hostHeader="dev.cloudportam.com" />
      <Binding name="Endpoint2" endpointName="SSL" />
    </Bindings>
  </Site>
</Sites>
<Endpoints>
  <InputEndpoint name="Endpoint1" protocol="http" port="8080" />
  <InputEndpoint name="SSL" protocol="https" port="8082" certificate="SSL" />
</Endpoints>

Now when we launch the application, it opens up https://localhost:8082/ and we just change the address to https://dev.cloudportam.com:8082 and everything works well.