1. What is WCF ?
- Stands for Windows Communication Foundation.
- Its code name is “Indigo”.
- It is a framework for building, configuring and deploying interoperable distributed services.
- It enables you to write more secure flexible services without any code change (using configuration).
- It also provide built-in support for logging. You can enable/disable logging using configuration.
WCF = Web Service + Remoting + MSMQ + COM+
(or)
WCF = ASMX + .Net Remoting + WSE + Messaging + Enterprise Services
2. What is Contract ? What are the types of Contract ?It is the agreement between client and service which specifies:
- [ServiceContract] - which services are exposed to the client.
- [OperationContract] - which operations the client can perform on the service.
- [DataContract] – which data types are passed to and from the service.
- [MessageContract] - allow the service to interact directly with messages. Message contracts can be typed or untyped and are useful in interoperability cases when another party has alreadydictated some explicit (typically proprietary) message format.
- [FaultContract] -which errors are raised by the service and how the service handles andpropagates errors to its clients.
5. What is binding ?
A binding is the set of configurations regarding the transport protocol, message encoding, communication pattern, reliability, security, transaction propagation, and interoperability.
A binding is the set of configurations regarding the transport protocol, message encoding, communication pattern, reliability, security, transaction propagation, and interoperability.
6. What are the types of bindings supported by WCF ? What are their advantages and disadvantages ?
Binding | Feature | Suitable For | Transport | Message encoding | Security Mode | Resource Manager | Transaction Flow |
BasicHttpBinding | Not secure by default. | Communication with WS-Basic Profile conformant Web Services like ASMX. | HTTP | Text | None | X | X |
WSHttpBinding | Secure, Interoperable. | Non-duplex service contracts. | HTTP | Text | Message | Disabled | WS-Atomic |
WSDualHttpBinding | Secure, Interoperable. | Duplex service contracts or communication through SOAP intermediaries. | HTTP | Text | Message | Enabled | WS-Atomic transaction |
WSFederationHttpBinding | Secure, Interoperable. | Supports the WS-Federation protocol, enabling organizations that are in a federation to efficiently authenticate and authorize users. | HTTP | Text | Message | Disabled | WS-Atomic transaction |
NetTcpBinding | Secure, Optimized. | Cross-machine communication between WCF applications. | TCP | Binary | Transport | Disabled | Ole transaction. |
NetPeerTcpBinding | Secure. | Multi-machine communication. | P2P | Binary | Transport | X | X |
NetNamedPipesBinding | Secure, Reliable, Optimized. | On-machine communication between WCF applications. | Named Pipes | Binary | Transport | X | Ole transaction. |
NetMsmqBinding | Cross-machine communication between WCF applications. | MSMQ | Binary | Message | X | X | |
MsmqIntegrationBinding | Does not use a WCF message encoding – instead it lets you choose a pre-WCF serialization format. | Cross-machine communication between a WCF application and existing MSMQ applications. | MSMQ | Pre-WCF format | Transport | X | X |
7. What is Endpoint in WCF ?Endpoint = Address (A) + Binding (B) + Contract (C)Address specifies where the services is hosted. Binding specifies how to access the hosted service. It specifies the transport, encoding, protocol etc. Contract specifies what type of data can be sent to or received from the service. Eg: <endpoint name="BasicHttpGreetingService" address="http://localhost:5487/MyService/GreetingService.svc" binding="basicHttpBinding" contract="MyNamespace.MyService.IGreetingService" />
8. Explain Address in detail ?It is the url which specifies the location of the service. Client can use this url to connect to the service and invoke the service methods.Eg: http://localhost:5487/MyService/GreetingService.svc9. Explain Binding in detail ?
|
Binding name | Supports reliability | Default reliability | Supports ordered delivery | Default Ordered delivery |
BasicHttpBinding | No | N/A | No | N/A |
NetTcpBinding | Yes | Off | Yes | On |
NetNamedPipeBinding | No | N/A(On) | Yes | N/A(On) |
WSHttpBinding | Yes | Off | Yes | On |
NetMsmqBinding | No | N/A | No | N/A |