X509CertificateRecipientServiceCredential Classe

Definição

Define um certificado usado por um serviço para se identificar.Defines a certificate used by a service to identify itself.

public ref class X509CertificateRecipientServiceCredential sealed
public sealed class X509CertificateRecipientServiceCredential
type X509CertificateRecipientServiceCredential = class
Public NotInheritable Class X509CertificateRecipientServiceCredential
Herança
X509CertificateRecipientServiceCredential

Exemplos

O código a seguir mostra como usar esse método para definir um certificado para uma credencial de serviço.The following code shows how to use this method to set a certificate for a service credential.

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

Propriedades

Certificate

Obtém ou define o certificado a ser usado para representar o serviço ao comunicar-se novamente com o cliente.Gets or sets the certificate to use for representing the service when communicating back to the client.

Métodos

Equals(Object)

Determina se o objeto especificado é igual ao objeto atual.Determines whether the specified object is equal to the current object.

(Herdado de Object)
GetHashCode()

Serve como a função de hash padrão.Serves as the default hash function.

(Herdado de Object)
GetType()

Obtém o Type da instância atual.Gets the Type of the current instance.

(Herdado de Object)
MemberwiseClone()

Cria uma cópia superficial do Object atual.Creates a shallow copy of the current Object.

(Herdado de Object)
SetCertificate(StoreLocation, StoreName, X509FindType, Object)

Especifica o certificado a ser usado para representar o serviço especificando parâmetros de consulta, como storeLocation, storeName, findType e findValue.Specifies the certificate to use for representing the service by specifying query parameters such as storeLocation, storeName, findType and findValue.

SetCertificate(String)

Especifica o certificado a ser usado para representar o serviço especificando o nome diferenciado da entidade.Specifies the certificate to use for representing the service by specifying the subject distinguished name.

SetCertificate(String, StoreLocation, StoreName)

Especifica o certificado a ser usado para representar o serviço especificando o nome diferenciado da entidade, o nome do repositório de certificados e o local do repositório.Specifies the certificate to use for representing the service by specifying the subject distinguished name, the certificate store name and store location.

ToString()

Retorna uma cadeia de caracteres que representa o objeto atual.Returns a string that represents the current object.

(Herdado de Object)

Aplica-se a