DRAG DROP
You are developing a Windows Communication Foundation (WCF) service named WCF1.
WCF1 will use a certificate to secure the communication channel.
You need to ensure that the WCF service uses a certificate to secure the communication channel.
How should you complete the code? To answer, drag the appropriate code blocks to the correct locations. Each
code block may be used once, more than once, or not at all. You may need to drag the split bar between panes
or scroll to view content.
Select and Place:
Explanation:
Target 1: ClientCredentialType
Target 2: MessageCredentialType.Certificate
Set the ClientCredential property to an appropriate value. The following code sets the property to Certificate.
WSHttpBinding b = new WSHttpBinding();
b.Security.Mode = SecurityMode.Message;
b.Security.Message.ClientCredentialType = MessageCredentialType.Certificate;Target 3: SetCertificate
On the client class, set the ClientCredentials property of the ClientBase<TChannel> class to an appropriate
value.
Example: // Set the certificate for the client.
cc.ClientCredentials.ClientCertificate.SetCertificate(
StoreLocation.LocalMachine,
StoreName.My,
X509FindType.FindBySubjectName,
“cohowinery.com”);
https://docs.microsoft.com/en-us/dotnet/framework/wcf/how-to-set-the-security-mode
https://docs.microsoft.com/en-us/dotnet/framework/wcf/how-to-specify-client-credential-values