WCF Interview Questions and Answers

One of the main component release by .net 3.0 framework was WCF(Windows communication foundations). If you want to take the interview on .net then you should be good in this WCF because it is one of the core components using in SOA.

What is the difference WCF and Web services?
Web services can only be invoked by HTTP. While Service or a WCF component can be invoked
by any protocol and any transport type. Second web services are not flexible. However, Services
are flexible. If you make a new version of the service then you need to just expose a new end.
Therefore, services are agile and which is a very practical approach looking at the current
business trends.

What are the main components of WCF?
The main components of WCF are
1. Service class
2. Hosting environment
3. End point

Where we can host WCF services?
Every WCF services must be hosted somewhere. There are three ways of hosting WCF services.
They are
1. IIS
2. Self Hosting
3. WAS (Windows Activation Service)

What is endpoint in WCF?
Every service must have Address that defines where the service resides, Contract that defines what the service does and a Binding that defines how to communicate with the service. In WCF the relationship between Address, Contract and Binding is called Endpoint.

What is binding and how many types of bindings are there in WCF?
A binding defines how an endpoint communicates to the world. A binding defines the transport (such as HTTP or TCP) and the encoding being used (such as text or binary). A binding can contain binding elements that specify details like the security mechanisms used to secure messages, or the message pattern used by an endpoint.  WCF supports nine types of bindings.( Basic binding, TCP binding, Peer network binding, IPC binding, Web Service (WS) binding, Federated WS binding, Duplex WS binding, MSMQ binding, MSMQ integration binding).

what are the various ways of hosting a WCF service?
There are three major ways to host a WCF service:-
• Self-hosting the service in his own application domain. This we have already covered in
the first section. The service comes in to existence when you create the object of Service
Host class and the service closes when you call the Close of the Service Host class.
• Host in application domain or process provided by IIS Server.
• Host in Application domain and process provided by WAS (Windows Activation
Service) Server.

What are the types of contract available in WCF?
The main contracts are:
a)Service Contract:Describes what operations the client can perform.
b)Operation Contract : defines the method inside Interface of Service.
c)Data Contract:Defines what data types are passed
d)Message Contract:Defines wheather a service can interact directly with messages

What is the proxy for WCF Service?
A proxy is a class by which a service client can Interact with the service.
By the use of proxy in the client application we are able to call the different methods exposed by the service

How can we create Proxy for the WCF Service?
We can create proxy using the tool svcutil.exe after creating the service.
We can use the following command at command line.
svcutil.exe *.wsdl *.xsd /language:C# /out:SampleProxy.cs /config:app.config

How to test the WCF Service?
We can use the WCF Test client to test the WCF Service. Tool enables users to input test parameters, submit that input to the service, and view the response.
We can use the following command at command line. wcfTestClient.exe URI1 URI2 …

What are SOAP Faults in WCF?
Common language runtime (CLR) exceptions do not flow across service boundaries. At the maximum, a CLR exceptions may propagate up to the service tier from business components. Unhandled CLR exceptions reach the service channel and are serialized as SOAP faults before reporting to clients. An unhandled CLR exception will fault the service channel, taking any existing sessions with it. That is why it is very importatnt to convert the CLR exceptions into SOAP faults. Where possible, throw fault exceptions

What happens if there is an unhandled exception in WCF?
If there is an unhandled exception in WCF, the the service model returns a general SOAP fault, that does not include any exception specific details by default. However, you can include exception details in SOAP faults, using IncludeExceptionDetailsInFaults attribute. If IncludeExceptionDetailsInFaults is enabled, exception details including stack trace are included in the generated SOAP fault. IncludeExceptionDetailsInFaults should be enabled for debugging purposes only. Sending stack trace details is risky.

Chere here for more advanced WCF Interview questions.

Similar Topics:


wcf interview questions and answers for experiencedwcf interview questions and answerswcf interview questions and answers for experienced in netwcf interview questions for experiencedadvanced wcf interview questions and answerswcf advanced interview questions and answersadvanced wcf interview questionswcf advanced interview questionswcf interview questions and answers for experiencewcf interview questions experienced
We will send you more information on WCF Interview Questions and Answers.
Enter your email address:
This entry was posted in .Net and tagged . Bookmark the permalink.