WCF Interview Questions and Answers
WCF is an abbreviated form of Windows Communication Foundation, which is a unified communication framework developed for distributed applications. In other words, it is a unified API for services and clients for the purpose of sending information between each other. The main characteristics of WCF are SOA, extensibility, and interoperability. This is the prime and most important information which is often asked during WCF Interview Questions. Given below are the commonly asked interview questions that will help you to crack WCF interviews. SOA (Service-Oriented Architecture) is an approach to protocol-independent, loosely coupled and standard-based distributed computing where software resources that are available over the network are considered as a service. Likewise, interoperability is also a prime feature of WCF, as it implements a number of WS-*standards. Even, WCF client/server platform configures itself to interoperate with REST, ATOM-feeds, Plain XML or JSON messages. Therefore, WCF provides a secure, reliable and transacted messaging platform along with interoperability.
Most Frequently Asked WCF Interview Questions
WCF is an abbreviated form of Windows Communication Foundation. In general, it is widely used to create and generate the interoperable, scalable and distributed application. .NET 3.0 is a WCF applications framework which is used for the creation of service-oriented and aligned applications. With the help of this framework, users can send asynchronous data from one part to another.
Therefore, WCF applications can be used in a distributed system that can be run on multiple systems without any sort of compatibility barriers.
Duplex in WCF allows clients and server to establish a communication pathway with each independently in which any of the entity can initiate a call to others. In order to establish communication between the source and destination duplex mode of communication would be used. If one entity is sending a message at the time another entity will receive the message. Moreover, in the duplex mode of communication, both source and destination will participate in the communication activity.
Throttling is a word which is derived from throughput keyword, it means work performed within the specific intervals of time. The throttling behavior in WCF is defined as a number of session user creates within a stipulated period of time.
Volatile letter queues- This is a queue which is used when you send information or message and want that message to be delivered on the proper time.
Dead letter queues- This queue is required so that client and server are not needed to run at the same time when the message is delivered.
|Web API||WCF service|
|Web application programming interface which is primarily used for the creation of full-blown REST a service which implies that WEB API does not need any data configuration and contracts to the level of WCF.||WCF was created for the development of SOAP-based services. It uses standard XML and schema over HTTL which leads to the degradation in the performance of the application.|
|WEB API support Any media content format||It uses Text format that includes XML|
|It uses URL patterns, HTTP methods as a service interface||WCF uses service contract as a service interface|
|The caching mechanism of WEB API is built-in HTTP application control||The caching mechanism of WCF service is handled by the application|
Massage contract in WCF is used to define the structure of data. It is important to define the structure of data before the application sends the packet from source to destination. In addition to this, the message contract is also used to control and maintain the structure of information (Message body) and serialization of process.
In general, WCF is an advanced level programming platform which is used for building, running and deploying application over distributed network services. Address finding in WCF is a technique which is used for binding the location address and transport address which is used for the establishment of communication with two peers.
Endpoints in WCF service is used for the purpose of establishing communication between endpoints of the services. With the help of endpoints, users can access the offered functionalities of the WCF services.
Four properties of endpoints-
- An address which is used to find the endpoint.
- The binding which specifies how the client can establish communication with the endpoint
- A binding that specifies how a client can communicate with the endpoint.
- A contract is used for the identification of operational variable
- A set of behaviors that specify and states implementation details of the endpoint.
Type of WCF Endpoints
- Single Single-on
A data contract is a formal agreement which is held between the client and service provider in which the data exchange method is explicitly defined. Additionally, with the help of data contract, the data is serialized and can be exchanged among two different entities.
After creating a WCF service, it is important to host the designed service so that client applications can use it. Additionally, WCF services can be hosted with the help of four ways namely- ISS (Internet Information Service) hosting, Self-hosting, WAS (Windows Activation Service) hosting, Windows Service Hosting.
In general exception handling is one of the features of object programming language and it is an error that accurate which occurs runtime. Exception handling is a technique which is used to handle runtime errors. In order to handle expectations try, catch and finally block are used. Id the expiration handling technique is unable to handle the runtime error then the execution of the application automatically terminated.
There are three ways of handling exception in WCF
KnownTypeAttribute is an attribute which allows specifying the types that should be included during the process of deserialization. The users are using KnownTypeAttribute only when they want to accept the service and return an inherited type.
In practice, HTTP binding is suitable for communicating securely with ASP.NET Web service (ASMX) based services. In addition to this, WCF services use HTTP binding service in order to transport text/XML ass a default message.
In order to create HTTP binding in WCF following steps need to be performed
- Create WCF HttpBinding project
- Open Visual Studio
- Create a New Project from the start page
- Go to File menu, select New and then click on the project
- A dialog box will pop up over the display screen
- With the help of installed templates select C#
- Inside C# select WCF and then select WCF service application
Yes, we have method overloading in WCF. In the general method, overloading is one of the optimal features that allow the users to create multiple methods with the same name but each method performs different functionality from each there in the context of input and output. In other words, method overloading methods name will be the same but the parameters differ from each other. Method overloading is used during compile time polymorphism.
There are different type of binding in WCF namely-
WCF service handles new about 40 requests and WCF handles each request with the help of call which implies that one instance of WCF service will be created for each request.
Some of the advantages and disadvantages of WCF web services are listed below-
- Interoperability (the single platform is used in order to exchange information using different routing protocols)
- Security and reliability (Provided with auditing, authentication, confidentiality, integrity features)
- Supports Ajax, REST and Plain OML
If you really want to crack the WCF interview than don’t miss to read our WCF Interview Questions.
- High level of abstraction
- Lost of a pre-used set of libraries
- Unclear to understand web services in RoR.