共用方式為


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)

適用於