<scopedCertificates> 的 <add> 元素

向作用域证书集合添加 X.509 证书。

<system.serviceModel>
  <behaviors>
    <endpointBehaviors>
      <endpointBehaviors> 的 <behavior>
        <clientCredentials>
          <serviceCredentials> 的 <serviceCertificate>
            <scopedCertificates> 元素
              <scopedCertificates> 的 <add> 元素

<add findValue="String"
          storeLocation="CurrentUser/LocalMachine"
          storeName=" CurrentUser/LocalMachine"
          targetUri="string"
         x509Type="FindByThumbprint/FindBySubjectName/FindBySubjectDistinguishedName/FindByIssuerName/FindByIssuerDistinguishedName/FindBySerialNumber/FindByTimeValid/FindByTimeNotYetValid/FindBySerialNumber/FindByTimeExpired/FindByTemplateName/FindByApplicationPolicy/FindByCertificatePolicy/FindByExtension/FindByKeyUsage/FindBySubjectKeyIdentifier" 
/> 

属性和元素

属性

属性 说明

targetUri

字符串。指定与证书相关的服务的 URI。

findValue

字符串。要搜索的值。

x509FindType

枚举。要搜索的证书字段之一。

storeLocation

枚举。要搜索的两个存储位置之一。

storeName

枚举。要搜索的系统存储之一。

子元素

无。

父元素

元素 说明

<scopedCertificates> 元素

表示特定服务为身份验证提供的 X.509(作用域)证书的集合。

备注

此元素使客户端能够根据与它通信的服务的 URL 来配置要使用的服务证书。这在已颁发令牌的方案中尤其有用,在这些方案中,客户端可与多个服务(终端服务以及中间的安全令牌服务)进行通信。对于使用基于证书的消息安全的绑定,此证书用于加密发送给服务的消息,并期望服务用它来对客户端的应答进行签名。

如果绑定需要服务的证书,但在 ScopedCertificates 中未找到服务 URL 的特定证书,则使用默认证书。

有关更多信息,请参见How To: Create a Federated Client的“作用域证书”部分。

示例

下面的示例向集合中添加一个 X.509 证书。

<behaviors>
 <endpointBehaviors>
  <behavior name="MyEndpointBehavior">
   <clientCredentials>
    <serviceCertificate>
     <scopedCertificates>
      <add targetUri="https://www.contoso.com" 
       findValue="www.Contoso.com" 
       storeLocation="LocalMachine"
       storeName="Root" 
       x509FindType="FindByIssuerName" />
     </scopedCertificates>
    </serviceCertificate>
   </clientCredentials>
  </behavior>
 </endpointBehaviors>
</behaviors>

另请参见

参考

ScopedCertificates
X509ScopedServiceCertificateElementCollection
X509ScopedServiceCertificateElement
X509CertificateRecipientClientCredential
ScopedCertificates

其他资源

How To: Create a Federated Client
Working with Certificates
Securing Clients
Securing Services and Clients