简体   繁体   中英

WCF Service: behavior with serviceCredentials with certificate - how should I configure it for Azure?

I have simple WCF Service Service1 with the following config:

<behaviors>
  <serviceBehaviors>
    <behavior name="SecuredBehavior">
      <serviceMetadata httpGetEnabled="true"/>
      <serviceDebug httpHelpPageEnabled="true" includeExceptionDetailInFaults="true"/>
      <serviceCredentials type="System.ServiceModel.Description.ServiceCredentials">
        <userNameAuthentication userNamePasswordValidationMode="Custom" customUserNamePasswordValidatorType="WCFS.Service1,WCFS"/>
        <serviceCertificate findValue="BasicWCFCert" storeLocation="LocalMachine" storeName="My" x509FindType="FindBySubjectName" />
        <windowsAuthentication includeWindowsGroups="false"/>
      </serviceCredentials>
    </behavior>
  </serviceBehaviors>
</behaviors>
<bindings>
  <wsHttpBinding>
    <binding name="SecuredWsHttpBinding">
      <security mode="Message">
        <message clientCredentialType="UserName"/>
      </security>
    </binding>
  </wsHttpBinding>
</bindings>
<services>
  <service name="WCFS.Service1" behaviorConfiguration="SecuredBehavior">
    <endpoint address="" binding="wsHttpBinding" bindingConfiguration="SecuredWsHttpBinding"
      name="End1" contract="WCFS.IService1" />
  </service>
</services>

So on my development machine I'm using this service with certificate "BasicWCFCert" stored in LocalMachine in "My" (Personal) location.

How should I change it before publishing this service in Azure? How can I tell Service1 to use one of certificates uploaded to Azure?

Have you tried attaching the cert in the role configuration screen as show below?

You can get the thumbprint by running certmgr.msc and going to the relevant certificate.

在此处输入图片说明

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM