WCF服务:带有证书的serviceCredentials的行为 - 我应该如何为Azure配置它?

时间:2012-11-14 13:30:55

标签: wcf security azure certificate

我有简单的WCF服务Service1,其中包含以下配置:

<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>

所以在我的开发机器上,我正在使用这个服务,证书“BasicWCFCert”存储在LocalMachine的“我的”(个人)位置。

在Azure中发布此服务之前,我该如何更改它? 如何告诉Service1使用上传到Azure的证书之一?

1 个答案:

答案 0 :(得分:1)

您是否尝试在角色配置屏幕中附加证书,如下所示?

您可以通过运行certmgr.msc并转到相关证书来获取指纹。

enter image description here