ServiceCredentials.ServiceCertificate Property

Gets the current certificate associated with this service.

Namespace:  System.ServiceModel.Description
Assembly:  System.ServiceModel (in System.ServiceModel.dll)

public X509CertificateRecipientServiceCredential ServiceCertificate { get; }

You can specify the certificate to use by calling members of the X509CertificateRecipientServiceCredential object returned by this property.

You can also set this value using the <certificate> for <identity> element in a client application configuration file.

This code shows how to specify the certificate that a service uses.

A ServiceHost class is created, followed by a single complex code statement that does the following:

	    Uri a = new Uri("net.tcp://MyMachineName/tcpBase");
	    Uri[] baseAddresses = new Uri[] { a };
	    ServiceHost sh = new ServiceHost(typeof(SayHello), baseAddresses);
	    sh.AddServiceEndpoint(c, b, "Aloha");

.NET Framework

Supported in: 4.6, 4.5, 4, 3.5, 3.0

.NET Framework Client Profile

Supported in: 4, 3.5 SP1
Was this page helpful?
(1500 characters remaining)
Thank you for your feedback
© 2015 Microsoft