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.
Q1.What is WCF? Briefly explain.
Windows Communication Foundation is a Software improvement kit (SDK) to broaden and deploy offerings in Windows. WCF provides a runtime environment for offerings. It enables Common Language Runtime (CLR) kinds of offerings to be exposed, while consuming other services as CLR types. WCF is a part of the .NET 3.zero framework and it requires .NET 2.zero, and it is able to run most effective on systems that support it.
Q2.What are the main components of WCF?
We want to outline 3 main components in WCF:-
Service class.
Hosting environment
End factor
Q3.Explain how does WCF works?
WCF follows the “Software as a Service” model, where all devices of functionality are described as services. For communication, every point is a portal or connection either with the client or other offerings. It is a application that exposes a collection of endpoints.
Q4.What are the protocols utilized in Message Layer in WCF ?
There are some capability of protocols that are used in messaging layer in WCF.
Ws-Security Channel:- It allows .To secure the message by way of implementing the ws-safety specification within the messaging layer of a provider.
Ws-Reliable Messaging Channel:- This protocols gives assure to deliver the message over channels.
Encodes:- It gives the quantity of encodes for message.
HTTP Channel:- It specifies that HTTP is used for handing over a message.
TCP Channel:- It specifies that TCP is used for turning in the message.
Transaction waft Channel:- It define the sample in which a message is transacted.
Named Pipe Channel:- It enables inter-manner communication (IPC).
MSMQ Channel:- It allows offerings to inter-perform the MSMQ Applications.
Q5.What are distinctive ways in which WCF may be hosted ?
The special website hosting techniques are
1.IIS web hosting–This is the most normally used website hosting technique.Here IIS is
used as a server and has following
advantages -> starts offevolved mechanically on the first client request,process recyling.
Disadvantage– It supports most effective http protocol
2.Self web hosting-This is hosting the WCF urself either in console/home windows
application also in windows carrier .
The host manner have to be walking before a patron makes a name to servc.
Its easier to debug and deploy.
Lifetime of services may be controlled using Open and Close methods.
WAS website hosting(Windows Activation Server web hosting)–WAS changed into introduced
with windows vista and it is shipped with IIS 7.zero. it's miles more powerful than
3.IIS 6.zero as it may aid http,tcp and named pipes while IIS 6.zero can
support most effective http.
4.Windows Service Hosting–Here the carrier may be programmed to start
while the system begins.
Q6.What is the difference WCF and Web services?
Web offerings can best be invoked by means of HTTP. While Service or a WCF component can be invoked by using any protocol and any delivery type. Second net offerings aren't flexible. However, Services are flexible. If you are making a new version of the provider then you want to simply expose a new end. Therefore, offerings are agile and that's a totally practical technique looking at the cutting-edge commercial enterprise trends.
Q7.What is the Message Layer in WCF ?
The message layer specifies the sample of exchanging data between channels which are used during service communication.
There are two kinds of channels utilized in WCF.
Transport layer:- HTTP,Named pipes,TCP and MSMQ are used in transport layer.
Protocol :- WS-Security and WS-Reliability are protocols that used in WCF Applications.
Q8.How transaction works in WCF?When we say Transaction, it means a couple of celebration will be worried in order to complete one unmarried logical operation. In case of SOA celebration means provider.
Normally WCF transaction observe faces. In Phase 1 Transaction manager checks whether or not all offerings have completed their work and equipped to commit. This phase is named as put together phase. If it’s accomplished then in Phase 2 actual commit takes place which is termed as Commit Phase.
Q9.What is message Contract in WCF ?
A Message contract affords control over the simple object access protocol (SOAP).Message which can be produced and consumed by way of WCF. It allows to direct get right of entry to to the SOAP header and bodies to trade the SOAP Message as in your requirement.The most important feature of SOAP Message is interoperability.
Q10.What is .Svc document?
Its the document in which provider is described and it will be the point of contact from the consumers.It contains name of provider and code behind file call.It is used to recognize about the carrier.
Q11.What are distinctive bindings supported by using WCF?
WCF consists of predefined bindings. They cover maximum of bindings widely wanted in every day application. However, just incase you discover that you need to define something custom WCF does no longer stop you. So let us try to recognize what each binding provides.
BasicHttpBinding: – This binding is used whilst we need to apply SOAP over HTTP. This binding can also be configured to be used as HTTPS. It can be additionally configured to send records in undeniable text or in optimized form like MTOM.
WsHttpBinding: – It is equal like BasicHttpBinding. In short, it uses SOAP over HTTP. But with it also supports dependable message transfer, safety and transaction. WS-Reliable Messaging, safety with WS-Security, and transactions with WS-Atomic Transaction supports dependable message.
NetTcpBinding: – This binding sends binary-encoded SOAP, including guide for dependable message transfer, safety, and transactions, without delay over TCP. The biggest downside of NetTcpBinding is that both server and customer ought to be additionally made in .NET language.
NetMsmqBinding: – This binding sends binary-encoded SOAP over MSMQ. This binding can most effective be used for WCF-to-WCF verbal exchange.
NetNamedPipesBinding:-Ths binding Sends binary-encoded SOAP over named pipes. This binding is simplest usable for WCF-to-WCF communication among methods on the identical Windows-primarily based machine.
Note: – An interprocess manipulate (IPC) protocol is used for exchanging data between applications, possibly jogging on one-of-a-kind computer systems in a community. The difference between Named pipes and TCP is that named pipes have top performance in terms of communication with in tactics. But while it comes to speak across network TCP holds the quality preference. So in case you are using WCF to communicate with process it’s the first-class choice to use in phrases for performance. Named pipes do now not perform while the site visitors is heavy compared to TCPIP.
Q12.Where the transaction manager does resides, in provider facet or purchaser side?
At purchaser aspect
Q13.What is Service Contract in WCF ?
A carrier contract is a settlement that defines the operations or methods to be had at stop points .It additionally defines the message exchange pattern together with behavior of the message in one way,duplex or request/reply.
Q14.What do you suggest by ABC in WCF ?
ABC in WCF means –
Address -> A stands for Address. It shows wherein you carrier is located.A URL is used to point to the location.Depending on whethere the carrier is hosted in http,tcp… the deal with varies. Eg-
http://localhost/Test
net.Tcp//localhost/Test
Binding ->B stands for Binding which specifies how the consumer ought to speak with the service.
Contract->C stands for contracts. It exposes the operation provided by way of the Service. It is a agreement.
Q15.What is SOAP in WCF ?
SOAP stands for Simple Object Access Protocol. A Message settlement provides manage over the easy item get right of entry to protocol (SOAP).The most important feature of SOAP Message is interoperability.
Q16.What are the various approaches of hosting a WCF provider?
There are 3 main approaches to host a WCF carrier:-
Self-website hosting the carrier in his personal application area. This we've already covered within the first section. The carrier comes in to existence while you create the object of Service Host magnificence and the provider closes whilst you name the Close of the Service Host class.
• Host in application domain or technique supplied with the aid of IIS Server.
• Host in Application area and manner furnished via WAS (Windows Activation Service) Server.
Q17.What is Activation and website hosting Layer in WCF?
The activation and website hosting layer renders various options for the offerings wherein they may be activated as well as hosted. we will host asp.net application services in ways.
Self hosting (ex. Window application,window service,console application.)
External server web hosting (ex. IIS ,WAS)
Q18.How it's far possible?
Because both will be using WS-Automic protocol for managing offerings.
Q19.What is an endpoint in WCF ?
ABC collectively represent an endpoint.Endpoint offers the consumer get admission to to the functionality exposed by using the service.
Q20.What is MEPs in WCF ?
MEPs stands for Message Exchange Patterns. There are three types of Message Exchange Patterns as given below:-
Request and Response
Data Gram
Duplex (1/2 and full)
Q1.What is WCF? Briefly explain.
Windows Communication Foundation is a Software improvement kit (SDK) to broaden and deploy offerings in Windows. WCF provides a runtime environment for offerings. It enables Common Language Runtime (CLR) kinds of offerings to be exposed, while consuming other services as CLR types. WCF is a part of the .NET 3.zero framework and it requires .NET 2.zero, and it is able to run most effective on systems that support it.
Q2.What are the main components of WCF?
We want to outline 3 main components in WCF:-
Service class.
Hosting environment
End factor
Q3.Explain how does WCF works?
WCF follows the “Software as a Service” model, where all devices of functionality are described as services. For communication, every point is a portal or connection either with the client or other offerings. It is a application that exposes a collection of endpoints.
Q4.What are the protocols utilized in Message Layer in WCF ?
There are some capability of protocols that are used in messaging layer in WCF.
Ws-Security Channel:- It allows .To secure the message by way of implementing the ws-safety specification within the messaging layer of a provider.
Ws-Reliable Messaging Channel:- This protocols gives assure to deliver the message over channels.
Encodes:- It gives the quantity of encodes for message.
HTTP Channel:- It specifies that HTTP is used for handing over a message.
TCP Channel:- It specifies that TCP is used for turning in the message.
Transaction waft Channel:- It define the sample in which a message is transacted.
Named Pipe Channel:- It enables inter-manner communication (IPC).
MSMQ Channel:- It allows offerings to inter-perform the MSMQ Applications.
Q5.What are distinctive ways in which WCF may be hosted ?
The special website hosting techniques are
1.IIS web hosting–This is the most normally used website hosting technique.Here IIS is
used as a server and has following
advantages -> starts offevolved mechanically on the first client request,process recyling.
Disadvantage– It supports most effective http protocol
2.Self web hosting-This is hosting the WCF urself either in console/home windows
application also in windows carrier .
The host manner have to be walking before a patron makes a name to servc.
Its easier to debug and deploy.
Lifetime of services may be controlled using Open and Close methods.
WAS website hosting(Windows Activation Server web hosting)–WAS changed into introduced
with windows vista and it is shipped with IIS 7.zero. it's miles more powerful than
3.IIS 6.zero as it may aid http,tcp and named pipes while IIS 6.zero can
support most effective http.
4.Windows Service Hosting–Here the carrier may be programmed to start
while the system begins.
Q6.What is the difference WCF and Web services?
Web offerings can best be invoked by means of HTTP. While Service or a WCF component can be invoked by using any protocol and any delivery type. Second net offerings aren't flexible. However, Services are flexible. If you are making a new version of the provider then you want to simply expose a new end. Therefore, offerings are agile and that's a totally practical technique looking at the cutting-edge commercial enterprise trends.
Q7.What is the Message Layer in WCF ?
The message layer specifies the sample of exchanging data between channels which are used during service communication.
There are two kinds of channels utilized in WCF.
Transport layer:- HTTP,Named pipes,TCP and MSMQ are used in transport layer.
Protocol :- WS-Security and WS-Reliability are protocols that used in WCF Applications.
Q8.How transaction works in WCF?When we say Transaction, it means a couple of celebration will be worried in order to complete one unmarried logical operation. In case of SOA celebration means provider.
Normally WCF transaction observe faces. In Phase 1 Transaction manager checks whether or not all offerings have completed their work and equipped to commit. This phase is named as put together phase. If it’s accomplished then in Phase 2 actual commit takes place which is termed as Commit Phase.
Q9.What is message Contract in WCF ?
A Message contract affords control over the simple object access protocol (SOAP).Message which can be produced and consumed by way of WCF. It allows to direct get right of entry to to the SOAP header and bodies to trade the SOAP Message as in your requirement.The most important feature of SOAP Message is interoperability.
Q10.What is .Svc document?
Its the document in which provider is described and it will be the point of contact from the consumers.It contains name of provider and code behind file call.It is used to recognize about the carrier.
Q11.What are distinctive bindings supported by using WCF?
WCF consists of predefined bindings. They cover maximum of bindings widely wanted in every day application. However, just incase you discover that you need to define something custom WCF does no longer stop you. So let us try to recognize what each binding provides.
BasicHttpBinding: – This binding is used whilst we need to apply SOAP over HTTP. This binding can also be configured to be used as HTTPS. It can be additionally configured to send records in undeniable text or in optimized form like MTOM.
WsHttpBinding: – It is equal like BasicHttpBinding. In short, it uses SOAP over HTTP. But with it also supports dependable message transfer, safety and transaction. WS-Reliable Messaging, safety with WS-Security, and transactions with WS-Atomic Transaction supports dependable message.
NetTcpBinding: – This binding sends binary-encoded SOAP, including guide for dependable message transfer, safety, and transactions, without delay over TCP. The biggest downside of NetTcpBinding is that both server and customer ought to be additionally made in .NET language.
NetMsmqBinding: – This binding sends binary-encoded SOAP over MSMQ. This binding can most effective be used for WCF-to-WCF verbal exchange.
NetNamedPipesBinding:-Ths binding Sends binary-encoded SOAP over named pipes. This binding is simplest usable for WCF-to-WCF communication among methods on the identical Windows-primarily based machine.
Note: – An interprocess manipulate (IPC) protocol is used for exchanging data between applications, possibly jogging on one-of-a-kind computer systems in a community. The difference between Named pipes and TCP is that named pipes have top performance in terms of communication with in tactics. But while it comes to speak across network TCP holds the quality preference. So in case you are using WCF to communicate with process it’s the first-class choice to use in phrases for performance. Named pipes do now not perform while the site visitors is heavy compared to TCPIP.
Q12.Where the transaction manager does resides, in provider facet or purchaser side?
At purchaser aspect
Q13.What is Service Contract in WCF ?
A carrier contract is a settlement that defines the operations or methods to be had at stop points .It additionally defines the message exchange pattern together with behavior of the message in one way,duplex or request/reply.
Q14.What do you suggest by ABC in WCF ?
ABC in WCF means –
Address -> A stands for Address. It shows wherein you carrier is located.A URL is used to point to the location.Depending on whethere the carrier is hosted in http,tcp… the deal with varies. Eg-
http://localhost/Test
net.Tcp//localhost/Test
Binding ->B stands for Binding which specifies how the consumer ought to speak with the service.
Contract->C stands for contracts. It exposes the operation provided by way of the Service. It is a agreement.
Q15.What is SOAP in WCF ?
SOAP stands for Simple Object Access Protocol. A Message settlement provides manage over the easy item get right of entry to protocol (SOAP).The most important feature of SOAP Message is interoperability.
Q16.What are the various approaches of hosting a WCF provider?
There are 3 main approaches to host a WCF carrier:-
Self-website hosting the carrier in his personal application area. This we've already covered within the first section. The carrier comes in to existence while you create the object of Service Host magnificence and the provider closes whilst you name the Close of the Service Host class.
• Host in application domain or technique supplied with the aid of IIS Server.
• Host in Application area and manner furnished via WAS (Windows Activation Service) Server.
Q17.What is Activation and website hosting Layer in WCF?
The activation and website hosting layer renders various options for the offerings wherein they may be activated as well as hosted. we will host asp.net application services in ways.
Self hosting (ex. Window application,window service,console application.)
External server web hosting (ex. IIS ,WAS)
Q18.How it's far possible?
Because both will be using WS-Automic protocol for managing offerings.
Q19.What is an endpoint in WCF ?
ABC collectively represent an endpoint.Endpoint offers the consumer get admission to to the functionality exposed by using the service.
Q20.What is MEPs in WCF ?
MEPs stands for Message Exchange Patterns. There are three types of Message Exchange Patterns as given below:-
Request and Response
Data Gram
Duplex (1/2 and full)
0 Comments