Postesy

Post for all Platform

wcf interview question

WCF is Microsoft’s unified programming model for building service-oriented applications. It enables developers to build secure, reliable, transacted solutions that can be integrated across platforms and interoperate with existing. This article contains the top 20 WCF interview questions and answers, in order to prepare you for the interview.

  1-Define Proxy in WCF.

ANSWER– There are importantly two ways in which one can interact with a client application in Windows Communication Foundation. One of them is utilizing the ChannedFactory and other being making proxy classes. Proxy is basically a class in Windows Communication Foundation whose help is taken to interact with a client application. The whole configuration through the proxy class can be achieved through this proxy class. No extra effort is required to produce the configuration setting for the concerned client. If the service is not tightly united or coupled, proxy class can be utilized in such cases. Proxy classes encapsulate the route of the service, it is the method or protocol used to interact with the client. It has service implementation.

2Define Fault Contract in WCF?

ANSWER– One way of tackling with errors in WCF is through the use of a Fault Contract. The main work of a Fault Contract is to tackle the mistakes or errors by the service class and display it on the client-side. If a client or user makes a call to service class and an unexpected error or exception gets displayed, for instance, SQL Server is not responding or Divide by Zero or several such errors, the service class shows an exception to the client using the Fault Contract. If we use the default settings, the exception would not be shown and it will not reach the client. However, WCF gives the option to tackle and provide the error message to the client from service by utilizing a SOAP Fault Contract.

3-What is Data Contract in WCF?

ANSWER- An official agreement between a service and a client that conceptually defines the data to be exchanged is referred to as a data contract. In, simple words, it is a formal contract between a service and a client. Such contracts can be either explicit or implicit. Data contract describes the format and kinds of data exchanged in-service messages, it relates that how data types can be serialized and deserialized. With serialization, one can change an object into a succession of bytes that can be transported over a network and on the other hand, deserialization allows a person to reassemble an object from a series of bytes that one obtains from a calling application. It is a versioning system that permits one to manage the alteration to structured data.

4- WHAT is Message Reliability in WCF?

ANSWER-WCF Reliable Messaging renders web services more dependable. It mainly solves two issues- Networks are not entirely dependable and calls to a web service get transmitted across a network. Networks face the issues of congestion and dropped signals. While in certain cases, calls do not reach the web service or the answers do not get reverted back. Running a business through web services is definitely a concern as one cannot rely on it and this is where WCF Reliability comes into the scene.WCF Reliable Messaging renders messaging reliable and dependable, it deals in ordered dependable messages over undependable networks.

5-What does one understand by Service Contract in WCF?

ANSWER– Service Contract is one of the important agreements between a service and a client. It mainly defines the operations a service shows or exposes before its counterpart on the other party or in simpler words, the client. A WCF Service Contract can be mapped to a Web Service Description Language. (WSDL). Although Service Contract can be used for a class as well, it is usually recommended to use the Service Contract for an interface. Service Contract explains the operations exposed by the service, the platform-independent depiction of the interface and the ways of the service.

6- Describe Transactions in WCF.

ANSWER-A transaction can be defined as a practical or logical unit of work comprising of more than one activity that should either be successful or unsuccessful at the same time. For instance, if one engages in online shopping, and the amount is debited from a bank but the ordered item was not delivered to the customer. In the above-mentioned example, bank operations were hosted in a different service and online shopping was conducted in a separate service. The online transaction did not work as there was an error in the database query, and totally unaware, the banking operations were finished entirely. For this very reason, one requires transactions to ensure that either of the operations should be a complete success or an absolute failure.

7-Define WCF Throttling.

ANSWERWCF Throttling gives some properties which can be utilized to bind the number of instances or sessions that can be formed or created at the level of the application. By making proper instance, the performance of the WCF service can be maximized. For WCF Performance Tuning, one of the most vital elements is the throttling of services.

8-Define Security Implementation in WCF? What are its various kinds?

ANSWER– In order to ensure that the required measures have been taken to protect the messages and to create or establish a security procedure for substantiating and authorizing calls, WCF gives a very simple and valuable configurable environment or surrounding to implement security. This is mainly done because WCF supports several protocols, for instance, TCP, MSMQ, and HTTP, etc. The different kinds of securities supported by WCF include Message Security, Transport Security and Transport with Message Credential Security.

9- Define Address in WCF.

ANSWER- An Address can be defined as a unique Uniform Resource Locator (URL) which recognizes the whereabouts of the service. It describes the network address for getting and sending messages. It is basically divided into four different parts- Scheme, Machine, Port, Path. Each and every service in WCF  is linked with a unique address. The address is given imports the location of the services and transmits the procedure which allows interacting with the services. The transport protocols permitted by WCF include HTTP, HTTPS, IPC, MSMQ, Service Bus, Peer Network, and TCP.

10- What do you understand by Self Hosting in WCF?

ANSWER– If one wants to host one WCF service within an answer locally, it is called Self Hosting. In order to use Self Hosting, one requires to include System.Service.Model.Service Host namespace Self Hosting is very simple to handle, it is not rigid, the debugging procedure is very simple, it can be easily deployed, and it allows all bindings and transports.

Leave a Reply

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