X509CertificateRecipientServiceCredential 类

定义

定义服务用于标识自身的证书。

public ref class X509CertificateRecipientServiceCredential sealed
public sealed class X509CertificateRecipientServiceCredential
type X509CertificateRecipientServiceCredential = class
Public NotInheritable Class X509CertificateRecipientServiceCredential
继承
X509CertificateRecipientServiceCredential

示例

下面的代码演示如何使用此方法设置服务凭据的证书。

NetTcpBinding b = new NetTcpBinding();
b.Security.Mode = SecurityMode.Message;
Type c = typeof(ICalculator);
Uri a = new Uri("net.tcp://MyMachineName/tcpBase");
Uri[] baseAddresses = new Uri[] { a };
ServiceHost sh = new ServiceHost(typeof(MyService), baseAddresses);
sh.AddServiceEndpoint(c, b, "Aloha");
sh.Credentials.ServiceCertificate.SetCertificate(
    StoreLocation.LocalMachine,
    StoreName.My,
    X509FindType.FindByThumbprint,
    "af1f50b20cd413ed9cd00c315bbb6dc1c08da5e6");
sh.Open();
Dim b As New NetTcpBinding()
b.Security.Mode = SecurityMode.Message
Dim c As Type = GetType(ICalculator)
Dim a As New Uri("net.tcp://MyMachineName/tcpBase")
Dim baseAddresses() As Uri = { a }
Dim sh As New ServiceHost(GetType(MyService), baseAddresses)
sh.AddServiceEndpoint(c, b, "Aloha")
sh.Credentials.ServiceCertificate.SetCertificate(StoreLocation.LocalMachine, StoreName.My, X509FindType.FindByThumbprint, "af1f50b20cd413ed9cd00c315bbb6dc1c08da5e6")
sh.Open()

属性

Certificate

获取或设置在向客户端反馈时用于表示服务的证书。

方法

Equals(Object)

确定指定对象是否等于当前对象。

(继承自 Object)
GetHashCode()

作为默认哈希函数。

(继承自 Object)
GetType()

获取当前实例的 Type

(继承自 Object)
MemberwiseClone()

创建当前 Object 的浅表副本。

(继承自 Object)
SetCertificate(StoreLocation, StoreName, X509FindType, Object)

通过指定查询参数(如 storeLocationstoreNamefindTypefindValue)来指定用于表示服务的证书。

SetCertificate(String)

通过指定主题可分辨名称指定用于表示服务的证书。

SetCertificate(String, StoreLocation, StoreName)

通过指定主题可分辨名称、证书存储区名称和存储区位置来指定用于表示服务的证书。

ToString()

返回表示当前对象的字符串。

(继承自 Object)

适用于