60+ WCF Interview Questions

60+ WCF Interview Questions

WCF Interview Questions

1) What is WCF? 

WCF represents Windows Communication Foundation. It is a structure which is utilized for structure, arranging and sending interoperable appropriated administrations. Utilizing WCF, you can send information as nonconcurrent messages starting with one administration endpoint then onto the next. An administration endpoint can be a piece of a persistently accessible administration facilitated by IIS, or it very well may be an administration facilitated in an application. An endpoint can be a customer of an administration that demands information from an administration endpoint. It gives an office to compose increasingly secure, adaptable administrations with no code change. It likewise gives worked in help to logging. It encourages you to empower/impair logging utilizing arrangement.

Its code name is "Indigo".

2) What are the WCF administration endpoints? 

WCF administration endpoint has three essential components: address, authoritative, and contract.

Address: It characterizes the location of the URL that recognizes the area of the administration and indicates the area where messages are gotten. It is determined as a Uniform Resource Identifier (URI). The URI mapping part names the vehicle instrument to use to achieve the location, for example, HTTP and TCP. The various leveled some portion of the URI contains a one of a kind area whose design is subject to the vehicle instrument.

The endpoint address empowers you to make extraordinary endpoint addresses for every endpoint in administration or, under specific conditions, to share a location crosswise over endpoints. The accompanying model demonstrates a location utilizing the HTTPS convention with a non-default port:

https://cohowinery:8005/ServiceModelSamples/CalculatorService

Authoritative: It characterizes how the administration can be gotten to, how an endpoint conveys to the world. It is built of a lot of parts considered restricting components that "stack" one over the other to make the correspondence framework. No less than, a coupling characterizes the vehicle, (for example, HTTP or TCP) and the encoding being utilized, (for example, content or double). A coupling can contain restricting components that indicate subtleties like the security instruments used to verify messages or the message design utilized by an endpoint.

Contract: It characterizes what is uncovered by the administration. Ties together different related activities into a solitary utilitarian unit. The agreement can characterize administration level settings, for example, the namespace of the administration, a relating callback contract, and other such settings. Much of the time, the agreement is characterized by making an interface in your preferred programming language and applying the ServiceContractAttribute credit to the interface. The real administration code results by actualizing the interface.

Activity contract

An activity contract characterizes the parameters and returns kind of activity. While making an interface that characterizes the administration contract, you imply an activity contract by applying the OperationContractAttribute credit to every strategy definition that is a piece of the agreement. The activities can be displayed as taking a solitary message and restoring a solitary message, or as taking a lot of sorts and restoring a sort. In the last case, the framework will decide the configuration for the messages that should be traded for that activity.

Message contract

Depicts the organization of a message. For instance, it announces whether message components ought to go in headers versus the body, what dimension of security ought to be connected to what components of the message, etc.

Blame contract

Can be related with an administration activity to signify blunders that can be come back to the guest. An activity can have at least zero shortcomings related with it. These blunders are SOAP blames that are displayed as special cases in the programming model.

Information contract

The depictions in metadata of the information type that an administration employments. This empowers others to interoperate with the administration. The information types can be utilized in any piece of a message, for instance, as parameters or return types. On the off chance that the administration is utilizing just basic sorts, there is no compelling reason to utilize information contracts expressly.

3) What are the basic segments utilized in WCF? 

A rundown of basic segments utilized in WCF:

Administration class

The administration runtime layer contains the practices that happen just amid the genuine task of the administration, that is, the runtime practices of the administration. Throttling controls what number of messages are handled, which can be differed if the interest for the administration develops to a preset breaking point.

Endpoint

WCF Service is a program that uncovered a gathering of the endpoints. Every Endpoint is an entry for speaking with the world. All the WCF correspondences are occurred through the endpoint. An endpoint comprises of three segments.

Facilitating Environment

An administration must be facilitated in some procedure. A host is an application that controls the lifetime of the administration. Administrations can act naturally facilitated or overseen by a current facilitating process.

4) What is the "Address" property of endpoint in WCF? 

The "Address" property is the piece of endpoint characterized in administration level. This property is utilized to determine the area where the administration is found.

5) What is the "Authoritative" property of endpoint in WCF? 

The "Authoritative" property is the piece of endpoint characterized in administration level. This property is utilized to determine the sort conventions, encodings, and transport.

These all elements are chosen by both the imparting parties.

6) What is the "Agreement" property of endpoint in WCF? 

The "Agreement" property is only an interface between the customer and server where customer and server speak with one another. Contracts are utilized to determine tasks accessible.

7) What is the administration? 

An administration is a lot of usefulness presented to the world. Administration introduction (SO) is a unique arrangement of standards and best practices for structure administration situated applications.

8) What is administration intermediary in WCF? 

WCF Proxies are utilized to convey among customer and server. The correspondence happens by trading the messages as solicitations and reactions. It will have the subtleties like Service Path, Protocol subtleties, etc.

9) What is "Administration Contracts" in WCF? 

The Service Contracts quality is utilized at the administration level for WCF administration. It gives the rundown of activities that can be performed from that administration.

Administration Contracts can be characterized as:

[ServiceContract]

10) What are the distinctive occurrence modes in WCF? 

A rundown of occurrence modes in WCF:

Per Call

Singleton

Per Session

11) What is "Per Call" occurrence mode in WCF? 

At the point when a solicitation has made to support, it makes another case of administration for every strategy call and this will be discarded once the reaction goes to the customer. This entire procedure is known according to call case mode.

12) What is "Per Session" occasion mode in WCF? 

Per session occasion mode makes a consistent session among administration and customer and it will be kept up till the finish of the session. At the point when customer demands from administration the session will be made and it is committed to the case for that customer and it will go the end when customer session closes.

13) What is "Singleton" example mode in WCF? 

In "Singleton" mode every one of the customers are associated with the single example of the administration and when administration designed for "Singleton" mode, an occasion will be made when administration is facilitated and it will be discarded once it closes down.

14) What do you mean by customer? 

The customer of an administration is the program unit expending its usefulness. A customer can be in any way similar to a Console application, Windows structure, WPF or Silverlight class or ASP.Net page and so forth.

15) How do WCF works? 

WCF pursues the model "Programming as a Service". In this model all units of usefulness are characterized as administrations and for correspondence, each point is an entry or association either with the customer or different administrations. It is a program that uncovered an accumulation of endpoints.

16) What is the distinction between ASMX web administrations and WCF? 

The principle distinction among WCF and ASMX web administration is that ASMX is intended to send and get messages utilizing SOAP over HTTP just while WCF encourages you to send and get messages utilizing any configuration over any vehicle convention.

ASMX web administrations can be facilitated just in IIS while WCF administration has all the accompanying facilitating alternatives:

IIS

WAS (Windows Process Activation Services)

Reassure Application

Windows NT Services

WCF gave Host

ASMX web administrations support is constrained to HTTP while WCF bolsters HTTP, TCP, MSMQ, NamedPipes.

ASMX Security is constrained. Ordinarily confirmation and approval are finished utilizing IIS and ASP.NET security arrangement and transport layer security. For message layer security, WSE can be utilized.

WCF gives a predictable security programming model for any convention and it bolsters a significant number of indistinguishable abilities from IIS and WS-* security conventions, also, it offers help for cases based approval that gives better grained authority over assets than job based security. WCF security is steady paying little respect to the host that is utilized to actualize WCF administration.

Another real contrast is that ASMX web administrations use XmlSerializer for serialization while WCF utilizes DataContractSerializer which is far superior in execution than XmlSerializer.

17) what number kinds of agreement WCF characterize? 

There are four sorts of agreements that WCF characterize:

Administration Contracts

The ServiceContract characteristic maps a CLR interface (or surmised interface, as you will see later on) to an innovation unbiased administration contract. The ServiceContract quality uncovered a CLR interface (or a class) as a WCF contract, freely of that type's perceivability.

Information Contracts

The portrayals in metadata of the information type that an administration employments. This empowers others to interoperate with the administration. The information types can be utilized in any piece of a message, for instance, as parameters or return types. In the event that the administration is utilizing just basic sorts, there is no compelling reason to utilize information contracts unequivocally.

Blame Contracts

Can be related with an administration task to indicate blunders that can be come back to the guest.

Message Contracts

Depicts the arrangement of a message. For instance, it pronounces whether message components ought to go in headers versus the body, what dimension of security ought to be connected to what components of the message, etc.

18) What are the necessities for facilitating a WCF administration? 

You need no less than an oversaw procedure, a ServiceHost occurrence and an Endpoint designed for facilitating a WCF administration.

Following are the conceivable methodologies for facilitating an administration:

Facilitating in a Managed Application/Self Hosting:

Comfort Application

Windows Application

Windows Service

Facilitating on Web Server

IIS 6.0 (ASP.NET Application bolsters just HTTP)

Windows Process Activation Service (WAS) for example IIS 7.0 backings HTTP, TCP, NamedPipes, MSMQ.

19) Which are the distinctive disengagement levels in WCF? 

Following is a rundown of various separation levels in WCF:

Peruse Uncommitted: Also known as filthy disengagement level. It ensures that degenerate Data can't be perused. This is the most reduced seclusion level.

Peruse Committed: It guarantees not to peruse the information that has been changed by some other application and isn't yet dedicated. It is the default level.

Repeatable Read: It stops the use of soil read and non-repeatable read. It expresses that information brought through a question will be bolted and won't be refreshed by some other exchange.

Serializable: It doesn't permit any alteration and expansion of new information till the exchange is finished. This is viewed as an exceptionally prohibitive dimension.

Depiction: It raises a mistake on adjusting an information that has just been changed by any exchange.

20) Give the location configuration of the considerable number of ties in WCF. 

A rundown of location positions and their separate ties:

TCF Address Format - net.tcp://neighborhood host:portnumber

HTTP Address Format - http://neighborhood host:portnumber

MSMQ Address Format - net.msmq://neighborhood host:portnumber

21) Explain the WCF RIA? 

WCF RIA is the system for building up the n-level application for RIA (Rich Internet App). It is utilized in Rich Internet Apps like Silverlight, AJAX and so on. WCF RIA is utilized to take care of the serious issues like Tight Coupling.

22) How might you produce an intermediary for WCF? 

You can produce intermediary by utilizing the accompanying advances:

Utilizing Visual Studio

Utilizing SvcUtil

23) What is authoritative? 

Restricting is utilized to characterize how an endpoint conveys to the world. It characterizes the vehicle, for example, HTTP or TCP. It can contain restricting components that indicate subtleties like the security systems used to verify message designs utilized by an endpoint.

24) What are the distinctive methods of correspondence in WCF? 

There are three methods of correspondence in WCF:

Single direction

In the One-Way activity mode, the customer will send a solicitation to the server and does not mind whether it is achievement or disappointment of administration execution. There is no arrival from the server side, it is single direction correspondence.

Solicitation Reply

At the point when as customer makes a solicitation to the WCF administration and customer will hang tight to get a reaction from administration (till receiveTimeout). Subsequent to getting the reaction it will begin executing the remainder of the announcement.

Callback

It is the administration to call the customer. In which, administration will go about as customer and customer will go about as administration.

25) What is the solicitation answer mode in WCF? 

At the point when a customer made a solicitation to an administration, it will hold up until it recovers the reaction.

In the event that the reaction isn't gotten until the given time, it will demonstrate a blunder.

In the event that the customer gets the reaction, at that point next directions will be executed.

26) what number sorts of restricting are there in WCF? 

WCF bolsters nine sorts of ties:

Fundamental authoritative

TCP official

Friend organize authoritative

IPC official

Web Services official

United Web Service authoritative

Duplex WS official

MSMQ official

MSMQ joining authoritative

27) What are the vehicle mappings upheld by WCF? 

WCF bolsters the accompanying transport blueprints:

HTTP

TCP

Companion organize

IPC (Inter Process Communication)

MSMQ

28) What are the methods for facilitating a WCF administration? 

The methods for facilitating a WCF administration are:

IIS

Self-Hosting

WAS(Window Activation Service)

29) What are the duplex contracts in WCF? 

In WCF, Duplex informing or get back to is utilized to speak with the customer. Over various transport framework Duplex informing in WCF is done like TCP, Named pipe and even HTTP. All things considered this is known as duplex contracts in WCF. Fundamentally duplex administration contract is a message trade design in which the two endpoints can send messages to the next freely. A duplex administration, in this manner, can send messages back to the customer endpoint, giving occasion like conduct. Duplex correspondence happens when a customer interfaces with an administration and furnishes the administration with a channel on which the administration can send messages back to the customer. Note that the occasion like conduct of duplex administrations just works inside a session.

30) What is the use of DataContracts in WCF? 

In WCF, we can speak with the server from our customer through a message. So messages will go and fro among server and customer. For security reason, we are serializing the messages sent over the wire.

"[DataContact]" trait is given at class level to serialize the class by utilizing "[Datamember]" characteristic over properties.

31) What is DataContractSerializer? 

DataContractSerializer is presented in .NET 3.0 and WCF utilizes DataContractSerializer as default one. However at this point this serializer can be utilized for other serialization purposes too. For serialization "WriteObject()" strategy is utilized.

For instance:

dataContractSerializer = new

ataContractSerializer(typeof(MyTestClassType));

32) How might you empower the metadata data of the administration? 

Following are two different ways to empower the metadata for WCF:

For Default Endpoint: tag is utilized in web.config record without determining the endpoint. 

For Custom Endpoint: tag is utilized in web.config document with determining the characterized endpoint. 

33) Which ties are utilized for metadata arrangement in WCF? 

A rundown of ties that are utilized for metadata:

mexHttpBinding

mexNamedPipeBinding

mexHttpsBinding

mexTcpBinding

34) How would you be able to test a WCF application without making a customer application? 

There is a device called - "wcftestclient.exe" utilized for testing the WCF administration without making a customer application. This instrument can be opened from visual studio order brief.

35) What is the vehicle and message unwavering quality? 

Transport unwavering quality: It offers point-to-point ensured conveyance at the system parcel level, just as ensures the request of the bundles.

Message dependability: It manages unwavering quality with message level free of what number of bundles are required to convey the message.

36) What is Transport Reliability in WCF? 

"Transport Reliability" determines the assurance of conveying bundles over a system as convention TCP does. It likewise keeps up the request of the parcels just as conveying of bundles.

37) What is SOA? 

SOA represents Service Oriented Architecture. It is an accumulation of administrations that decide how the correspondence is conceivable between two processing substances to accomplish certain business usefulness and furthermore how one element can take a shot at sake of other element.

38) What is the use of "receiveTimeout" property in WCF? 

The "recieveTimeout" property is utilized to get/set the time interim to makes an association dynamic.

39) How would you be able to create intermediaries utilizing Svcutil in WCF? 

SvcUtil is an order line utility. You ought to compose the accompanying order to create intermediary:

40) Which styles of models are bolstered in WCF? 

WCF administration bolsters 2 styles of models:

RPC style: In RPC style we can utilize the serialize types and it gives the component that is accessible for nearby calls.

Message style: In message style WCF enables the message header to be modified and it likewise enables us to characterize the security for body and header messages.

41) What is the single direction mode in WCF? Clarify. 

In WCF single direction mode, a customer sends a solicitation to the server yet does not hold up till the reaction comes. It couldn't care less if the solicitation is fizzled or succeeded. The Client won't be obstructed for this situation until it gets the reaction.

42) What is Callback mode in WCF? Clarify. 

Ans: The WCF callback mode is an extraordinary sort of mode where WCF on the get back to calls the strategy for customer and in this situation WCF administration goes about as a customer and customer goes about as an administration.

This mode isn't bolstered by "HTTPBinding" so "WSDualHttpBinding" is utilized in this mode.

43) What are the diverse sorts of exchange chiefs upheld by WCF? 

These are three sorts of exchange chiefs bolstered by WCF:

Light Weight

WS-Atomic Transaction

OLE Transaction

44) What are the MEP in WCF? 

MEP represents Message Exchange Pattern. There are three kinds of Message Exchange Patterns are permitted:

DataGram

Solicitation and Response

Duplex

45) What is the location group in WCF? 

Sentence structure of location design in WCF:

46) What is Throttling in WCF? 

In WCF, "Throttling" is utilized to restrain the sessions or cases to be made at an application level. It is utilized to help the execution.

47) What is the utilization of "maxConcurrentCalls" in Throttling? 

The "maxConcurrentCalls" property in throttling is utilized to confine the absolute number of calls which are setting off to the administration cases. Its default esteem is 16.

48) What is "Know Types" in WCF? 

The KnowType is a credit which is utilized to the parent class in such a case that you characterize the perplexing class as the property of class then it would be troublesome for the compiler amid the de-serialization process.

49) Give a case of KnowType. 

See this precedent:

[KnownType(typeof(TestClassCar))]

[KnownType(typeof(TestClassTruck))]

[DataContract]

open class TestClassVehicle

{

}

[DataContract]

open class TestClassCar : TestClassVehicle

{

}

[DataContract]

open class TestClassTruck : TestClassVehicle

{

}