Which code segment should you use?

You are creating an endpoint for a Windows Communication Foundation service by using Microsoft .NET Framework 3.5. You create the endpoint by using a custom binding. You write the following code segment.

BasicHttpBinding binding=new BasicHttpBinding();
binding.Security.Message.ClientCredentialType=
BasicHttpMessageCredentialType.Certificate;
binding.Security.Mode=BasicHttpSecurityMode.Message; CustomBinding cb=new CustomBinding(binding);
BindingElementCollection bec=cb.CreateBindingElements();

You need to prevent the custom binding from making a persistent connection to the service endpoint. Which code segment should you use?

You are creating an endpoint for a Windows Communication Foundation service by using Microsoft .NET Framework 3.5. You create the endpoint by using a custom binding. You write the following code segment.

BasicHttpBinding binding=new BasicHttpBinding();
binding.Security.Message.ClientCredentialType=
BasicHttpMessageCredentialType.Certificate;
binding.Security.Mode=BasicHttpSecurityMode.Message; CustomBinding cb=new CustomBinding(binding);
BindingElementCollection bec=cb.CreateBindingElements();

You need to prevent the custom binding from making a persistent connection to the service endpoint. Which code segment should you use?

A.
cb.SendTimeout=TimeSpan.Zero;

B.
binding.ReceiveTimeout=TimeSpan.Zero;

C.
foreach (BindingElement bindingElement in bec){ HttpTransportBindingElement element= (HttpTransportBindingElement) bindingElement; element.KeepAliveEnabled=false;}

D.
foreach (BindingElement be in bec){ if (be is HttpTransportBindingElement) { HttpTransportBindingElement httpElement= (HttpTransportBindingElement)be; httpElement.KeepAliveEnabled=false; }}



Leave a Reply 0

Your email address will not be published. Required fields are marked *