MCTS Windows Communication Foundation (WCF) 1 — Questions and Answers
Question 1: In WCF, what does the ABC acronym stand for when describing an endpoint?
- Address, Binding, Contract (Correct answer)
- Application, Binding, Channel
- Address, Behavior, Contract
- Application, Behavior, Channel
Correct answer: Address, Binding, Contract
Every WCF endpoint is defined by its Address (where it is), Binding (how to communicate), and Contract (what operations are available).
Question 2: Which WCF binding is optimized for cross-machine communication over TCP and is NOT suitable for internet-facing services?
- BasicHttpBinding
- WSHttpBinding
- NetTcpBinding (Correct answer)
- WebHttpBinding
Correct answer: NetTcpBinding
NetTcpBinding uses the TCP transport for efficient intranet communication but is not suitable for internet scenarios because TCP port 808 is typically blocked by firewalls.
Question 3: Which .NET attribute marks an interface as a WCF service contract?
- [DataContract]
- [ServiceContract] (Correct answer)
- [OperationContract]
- [MessageContract]
Correct answer: [ServiceContract]
[ServiceContract] is applied to an interface or class to declare it as a WCF service contract, defining the overall service.
Question 4: What is the default message encoding used by BasicHttpBinding?
- MTOM
- Binary
- Text/XML (Correct answer)
- JSON
Correct answer: Text/XML
BasicHttpBinding uses text-encoded XML by default, ensuring interoperability with non-WCF SOAP clients.
Question 5: Which WCF service behavior must be enabled to allow clients to retrieve the service's WSDL metadata?
- serviceDebug
- serviceMetadata (Correct answer)
- serviceThrottling
- serviceAuthorization
Correct answer: serviceMetadata
The serviceMetadata behavior, with httpGetEnabled or httpsGetEnabled set to true, exposes the WSDL so clients can generate proxies.
Question 6: Which class is used to self-host a WCF service inside a managed .NET application such as a console app?
- ServiceProxy
- ChannelFactory
- ServiceHost (Correct answer)
- ServiceEndpoint
Correct answer: ServiceHost
ServiceHost is instantiated with the service type and base addresses to host a WCF service outside of IIS in any managed process.
Question 7: Which WCF binding uses SOAP 1.2 by default and provides WS-* protocol support such as reliable messaging and security?
- BasicHttpBinding
- NetNamedPipeBinding
- WebHttpBinding
- WSHttpBinding (Correct answer)
Correct answer: WSHttpBinding
WSHttpBinding implements SOAP 1.2 and supports WS-Security, WS-ReliableMessaging, and WS-AtomicTransaction, making it suitable for secure interoperable services.
In WCF, what does the ABC acronym stand for when describing an endpoint?