<defaultCertificate> 元素

指定在服务或 STS 未通过协商协议提供证书时要使用的 X.509 证书。

configuration
  system.serviceModel
    behaviors
      endpointBehaviors
        behavior
          <clientCredentials>
            <serviceCertificate>
              <defaultCertificate>

语法

<defaultCertificate findValue="String"
                    storeLocation=" CurrentUser/LocalMachine"
                    storeName="AddressBook/AuthRoot/CertificateAuthority/Disallowed/My/Root/TrustedPeople/TrustedPublisher"
                    x509FindType="FindByThumbPrint/FindBySubjectName/FindBySubjectDistinguishedName/FindByIssuerName/FindByIssuerDistinguishedName/FindBySerialiNumber/FindByTimeValid/FindByTimeNotYetValid/FindByTimeExpired/FindByTemplateName/FindByApplicationPolicy/FindByCertificatePolicy/FindByExtension/FindByKeyUsage/FindBySubjectKeyIdentifier" />

特性和元素

以下几节描述了特性、子元素和父元素。

特性

属性 说明
findValue 字符串。 要搜索的值。
x509FindType 枚举。 要搜索的证书字段之一。
storeLocation 枚举。 要搜索的两个系统存储位置之一。
storeName 枚举。 要搜索的系统存储之一。

findValue 属性

说明
String 值取决于搜索的字段(由 X509FindType 属性指定)。 例如,如果搜索指纹,则此值必须为十六进制数字字符串。

x509FindType 属性

说明
枚举 值包括:FindByThumbprint、FindBySubjectName、FindBySubjectDistinguishedName、FindByIssuerName、FindByIssuerDistinguishedName、FindBySerialNumber、FindByTimeValid、FindByTimeNotYetValid、FindBySerialNumber、FindByTimeExpired、FindByTemplateName、FindByApplicationPolicy、FindByCertificatePolicy、FindByExtension、FindByKeyUsage 和 FindBySubjectKeyIdentifier。

storeLocation 属性

说明
枚举 CurrentUser 或 LocalMachine。

storeName 属性

说明
枚举 值包括:AddressBook、AuthRoot、CertificateAuthority、Disallowed、My、Root、TrustedPeople 和 TrustedPublisher。

子元素

无。

父元素

元素 说明
<serviceCertificate> 指定客户端对服务进行身份验证时使用的证书。

备注

对于使用基于证书的消息安全的绑定,此配置元素指定的证书用于加密发送给服务的消息,并期望服务用它来对客户端的应答进行签名。 如果服务未指定任何证书,它只存储要使用的一个证书。

示例

下面的示例指定了两个证书,一个证书用于 URI 以 http://www.contoso.com 开头的终结点,另一个证书用于不执行证书协商的所有其他终结点。

<serviceCertificate>
  <defaultCertificate findValue="www.contoso.com"
                      storeLocation="LocalMachine"
                      storeName="TrustedPeople"
                      x509FindType="FindByIssuerDistinguishedName" />
  <scopedCertificates>
    <add targetUri="http://www.contoso.com"
         findValue="www.contoso.com"
         storeLocation="LocalMachine"
         storeName="Root"
         x509FindType="FindByIssuerName" />
  </scopedCertificates>
  <authentication revocationMode="Online"
                  trustedStoreLocation="LocalMachine" />
</serviceCertificate>

请参阅