Explore topic-wise InterviewSolutions in .

This section includes InterviewSolutions, each offering curated multiple-choice questions to sharpen your knowledge and support exam preparation. Choose a topic below to get started.

1.

How can we handle Multiple endpoints for WCF Service?

Answer»

How can we handle MULTIPLE endpoints for WCF SERVICE?
Below are the SYNTAX or we can SAY the CODE to handle multiple endpoints in WCF Services.

WCF endpoints

2.

Can you define what are the standard Endpoints?

Answer»

Can you define what are the standard Endpoints?
In WCF, For Metadata EXCHANGE, web and discovery there are set of pre-defined endpoints knows as Standard Endpoints. To CONFIGURE standard endpoints we will use config files. Below are the list of 8 standard endpoints:-
(1)mexEndpoint
(2)webHttpEndpoint
(3)webScriptEndpoint
(4)workflowControlEndpoint
(5)announcementEndpoint
(6)discoveryEndpoint
(7)udpAnnouncementEndpoint
(8)udpDiscoveryEndpoint

3.

Difference between Exception handling of WCF and WebService

Answer» DIFFERENCE between Exception handling of WCF and WebService
All the Unhandled EXCEPTIONS in Web services are RETURNED to the CLIENT as SOAP faults.
But in WCF Services unhandled exceptions are not returned to CLIENTS as SOAP faults. We need to do a configuration setting for the unhandled exceptions to return to clients for debugging.
4.

Types of security avail in WCF

Answer» WCF have two types of SECURITY thats are as Below:-
(1)Transport Security
(2)Message Security
(1)Transport Security: Transport level security happens at the channel level.Transport level security is the easiest to implement as it happens at the communication level. WCF uses transport protocols like TCP, HTTP, MSMQ ETC and every of these protocols have their own security mechanisms. One of the common implementation of transport level security is HTTPS. HTTPS is implemented over
HTTP protocols with SSL providing the security mechanism. No coding change is required it s more of using the existing security mechanism provided by the protocol.
(2)Message Security: Message level security is implemented with message DATA
itself. Due to this it is independent of the protocol. Some of the common ways of implementing message level security is by encrypting data using some standard
encryption algorithm.
5.

What are the advantage of WCF

Answer»

(1)WCF is INTEROPERABLE with other services as compared to .NET Remoting where client and service both have .net
(2)WCF service provide better reliability and security in compared to ASMX web services.
(3)WCF has ability to SUPPORT for multiple protocols just like TCP/IP, HTTP, PIPE, MSMQ etc.
(4) WCF can also be hosted outside IIS
(5)WCF can be hosted in managed WINDOWS applications, a windows service, and WAS (Windows Process Activation Service)
(6) WCF PROVIDES customisation just like event hooks into service start ,end and init custom global error Handling etc. etc.
(7)In case of implementing security model there is no need do much changes for implement by making little configuration we can do this

6.

What are the duplex contracts in WCF

Answer»

What are the duplex contracts in WCF
Duplex messaging or call-back is USED in WCF to COMMUNICATE with the client. On different TRANSPORT system Duplex messaging in WCF is done LIKE TCP,Named pipe and even HTTP. And this is known as duplex contracts in WCF.

7.

Difference between WCF vs Web API

Answer»

Difference between WCF vs Web API
Below are the 7 main difference between WCF and Web API
(1)WCF have option for Request-Reply, One-Way or duplex option while Web API is by default Request-Reply only.
(2)WCF doesnot SUPPORT any MVC features on the other hand Web API supports MVC features.
(3)WCF stands for Windows Communication Foundation whereas API stands for Application Program Interface.
(4)WCF is mainly used for developing SOAP based services on the other hand Web API used for both SOAP BASE and RestFul services.
(5)WCF supports HTTP, Custom transport protocol and UDP while Web API supports only HTTP protocol.
(6)WCF supports message security, message queues, duplex communication, transaction whereas Web API does not support this.
(7)WCF offers TEXT, MTOM and Binary Encoding support on the other hand Web API supports the UTF-8 encoding format.

8.

what is WCF and its purpose

Answer» Windows Communication Foundation (WCF) is a FRAMEWORK that's help to build service oriented applications or we can say WCF is a programming platform and runtime SYSTEM for build, configure and deploy network-distributed SERVICES. It is the latest service oriented TECHNOLOGY comes with .Net Framework 3.0 or latest version.WCF is a combined features of Web Service, Remoting, MSMQ and COM+. WCF provides a common platform for all .NET communication. WCF manily USED to transfer asynchronous messages from one service endpoint to another.SOAP is used by default, but the messages can be in any format, and conveyed by using any transport protocol and the messages can be as simple as a single character or we can also sent as XML, or as complex as a stream of binary data. WCF can automatically create metadata to explain applications built using the technology in WSDL, and it also provides a tool for generating clients for those applications from the WSDL.

WCF Helps IN:-
(1)Its provide a secure service to do business transactions.
(2)Its helps in communication or exchange data in real time.
(3)Its helps in chat services which allow communication.
(4)Its helps in logical presentation or visualization of data.
(5) Its helps Silverlight application to poll a service for the latest data feeds.
(6)Its help Windows Workflow Foundation as a WCF service
9.

Name some standard bindings available in WCF

Answer»

Below are the some LIST of BINDING AVAILABLE in WCF:-
1. BasicHttpBinding
2. NetPeerTcpBinding
3. WSFederationHttpBinding
4. NetNamedPipeBinding
5. WSHttpBinding
6. WSDualHttpBinding
7. NetTcpBinding
8. NetMsmqBinding
9. MsmqIntegrationBinding

10.

What is endpoint in WCF service

Answer»

The ENDPOINT is an Interface which defines how a client will communicate with the service. It CONSISTS of three MAIN points: ADDRESS,Binding and Contract.

11.

Transfer Security Mode in WCF

Answer»

Transfer Security Mode in WCF
There are three aspects to transfer security when we talk about client server secured communication. Below are the name of these 3:-

(1)Message Integrity:- It will check message used in communication is not tampered by any malicious user.
(2)Message Privacy:-It will CHCK the confidentiality of the message that it should not be read by malicious user.
(3)Transfer Security:-It will check that only authenticate user can read the message in communication.

Now comes to modes of different modes of transfer security for above three aspects are given below. There are five different modes define below:-

(1)No transfer security mode
(2)Transport security mode
(3)Message security mode
(4)Mixed transfer security mode
(5)Both security modes

(1)No transfer security mode:- Here we cannot apply any security while doing COMMUNCATION between server and client
< wsHttpBinding >
< binding name="WCFSecurityEx">
< security mode="None"/>
< /binding>
< /wsHttpBinding>

(2)Transfer security mode:-Here WCF uses secured communication protocol and these secure transports are HTTPS, TCP, IPC and MSMQ. It will encrypts all communcation on the channel and provides integrity, mutual authentication and privacy. It will provides point-to-point security.
One of the drawback is that will will secure only at channel level. Message inside the channel will not get secured.
And it is used in intranet application.
< wsHttpBinding >
< binding name="WCFSecurityEx">
< security mode="Transport"/>
< /binding>
< /wsHttpBinding>

(3)Message security mode:-Here message will get encrypted. Encrypting the message rather than transport enables the service to communicate SECURELY over non secure transport such as HTTP. It provides end-to-end security.
And one of its disadvantage is thet it may introduce call latency due to its inherent overhead.
It is also used in internet application.
< wsHttpBinding >
< binding name="WCFSecurityEx">
< security mode="Message"/>
< /binding>
< /wsHttpBinding>

(4)Mixed transfer security mode:-Here we use transport security for message privacy, integrity and service authentication and use Message security for securing client credential.
One of disadvantage of this is thet it will secure only point-to-point as nautre of Transport security.
< wsHttpBinding >
< binding name="WCFSecurityEx">
< security mode="TransportWithMessageCredential"/>
< /binding>
< /wsHttpBinding>

(4)Both security mode:- Here we will use both Transport and Message security. SO message is secured using message security and then it is transferred to the service using secure transport. It will maximize the security but OVERLOAD the perormance
< wsHttpBinding >
< binding name="WCFSecurityEx">
< security mode="Both"/>
< /binding>
< /wsHttpBinding>

12.

Difference between asp.net and wcf session

Answer»

Difference between asp.net and WCF session
Below are the difference between asp.net and WCF session

1)ASP.NET:-ASP.NET sessions are initiated by server only
WCF:-While WCF sessions are initiated by WCF Client.

(2)ASP.NET:-ASP.NET sessions data can be accessed in unordered way
WCF:-but In WCF session MESSAGES delivered during a session are processed in the ORDER in which they are received.

(3)ASP.NET:-ASP.NET has a GENERAL data storage mechanism for session
WCF:-In WCF there is no such data storage.

13.

Different isolation levels provided in WCF?

Answer»

Different isolation levels provided in WCF?
Below are the 4 main isolation levels provided in wcf
(1)READ UNCOMMITTED:- Here an uncommitted transaction can be read and this transaction can be ROLLED back later on.
(2)READ COMMITTED:- Here we will not read data of a transaction that has not been committed yet.
(3)REPEATABLE READ:- Here locks are placed on all data and another transaction cannot read.
(4)SERIALIZABLE:- It will not allow other TRANSACTIONS to insert or update data until the transaction is COMPLETE.

14.

Code to define multiple endpoints for a WCF service?

Answer»

Code to DEFINE multiple endpoints for a WCF service?
Answer:-Below is the code which DEFINES multiple endpoints for WCF service.



WCF Endpoint

15.

Difference between ASP.NET vs WCF

Answer»

Difference between ASP.NET vs WCF
Below are most important difference between ASP.NET and WCF
WCF
(1)To define WCF service ServiceContract and OperationContract attributes are used.
(2)WCF supports varioud protocols like HTTP, HTTPS, TCP, MSMQ and Named Pipes.
(3)We can host WCF application in 4 WAYS
(i)IIS
(ii)WAS
(iii)Self HOSTING
(iv)WINDOWS Service
(4)WCF is more securable then WebServices and also used for Messaging, Reliability and for transaction for AJAX and REST supports.
(5)We can serialize DataCOntract by using System.Runtime.Serialization.
(6)WCF supports different service operations like One-Way, Request-Response and Duplex service operations.
(7)WCF much faster then Web Services.
(8)Here in WCF HashTables can be SERIALIZED.
(9)WCF supports Multi-threading with the help of ServiceBehaviour class.
(10)Its supports encoding like XML,MTOM and Binary message encoding.
(11)WCF have better exception handling by using FaultContract. And will does return client the unHandled Exceptions.

ASP.NET
(1)We use WebService and WebMethod attributesfor defining Web Services.
(2)WebService will support only HTTP, HTTPS protocols.
(3)We can host this in IIS only.
(4)Secuirty is less secure as copared to WCF.
(5)Here we can have option like XML serializer by using System.XML.Serialization.
(6)It supports only 2 service operations like One-Way and Request-Reponse.
(7)WEB Service are slower than WCF.
(8)Here HashTables will not be serialized. It can serialize only those collections which implement IEnumerable and ICollection.
(9)It doesnot support Multi-Threading.
(10)It supports XML and MTOM message encoding only.
(11)Here unHandled Exception returns to the client as SOAP Faults.

16.

Multiple host with there Protocol Support with WCF

Answer»

Below table shows all the different multiple host available in wcf and with there PROTOCOL details
HOSTING Environment:-Windows console and form application
Supported protocol:-HTTP,net.tcp,net.pipe,net.msmq

Hosting Environment:-Windows SERVICE application (FORMERLY known as NT services)
Supported protocol:-HTTP,net.tcp,net.pipe,net.msmq

Hosting Environment:-Web server IIS6
Supported protocol:-http, wshttp

Hosting Environment:-Web server IIS7 - Windows Process Activation Service (WAS)
Supported protocol:-HTTP,net.tcp,net.pipe,net.msmq

17.

What do you mean by WCF and WPF and WWF

Answer»

What do you mean by WCF and WPF and WWF
WPF is also known as AVALON its basically a presentation PLATFORM provided by Microsoft. Its a rich client applications which have full graphical capabilities . Its provide powerful, flexible programming model also INTEGRATES support for flexible layout, high-quality resolution-independent graphics, animation, video and 3D. Basically it is designed to provide the full capabilities of the high-performance graphics cards, it offers high-level ABSTRACTIONS that offer great power to the developer for less development effort than ever before.

WCF is also knowon as Indigo . Its a set of .NET technologies for building and running connected systems comes with asp.net 3.0 and 3.5 and for asp.net 2.0 user have to INSTALL the MS add in component for WCF. . WCF comes up as a replacement for Remoting and Web service in dotnet. It can use the protocols like Http and TCP comes with default windows based security feature. The componets WCF are data contract, Service Contract and the Service programme. WCF can be extended to use protocols other than SOAP to communicate with Web services.

WWF is also known as WORKFLOW .We can automate all the process there may be some points in a process will require interaction from a human, DEVICE or perhaps even another system. A workflow is the steps in a path a of process that takes into account points where interactions take place. Initally WWF engine will work in just Visual Studio 2005 for the moment but will soon be included in Biztalk and Sharepoint services.

18.

Advantage of WCF

Answer»

(1)WCF services is more reliabe and secure as compared to ASMX web services.
(2)Other IMPORTANT feature of WCF is interoperable with other services when compared to .Net Remoting,where the client and service have to be .Net
(3)WCF Supports Scaling
(4)WCF Load Balancing
(5)Its faster than ASMX
(6)With the HELP of WCF we can create different components so we can create new components for security, TRANSPORT, authentication.
(7)We can easily create security model and changing the binding in WCF with less effort or with Small changes in the configuration will make your requirements.
(8)WCF has integrated logging mechanism, changing the configuration file SETTINGS will provide this functionality. In other technology developer has to write the code.
(9)WCF is Interoperability, for java, and more.

19.

What are the main components of WCF

Answer»

Below are the some of MAIN COMPONENTS of wcf and some little information about that are given Below : -
(1)Service: logic that is implemented by using any .Net Language
(2)Host: The environment where the service is situated.
(3)Endpoints: The way a service is BEHAVE and exposed to OUTSIDE world

20.

something about WCF

Answer»

WCF stands for Windows Communication Foundation is a framework for distributed programming. The WCF is designed provides manageable approach for distributed computing, broad interoperability, and direct support for SOA. It contains serialization facilities that enable loose coupling and versioning.
By WCF we can SEND data as asynchronous messages from one service endpoint to another. A service endpoint can be part of a continuously available service hosted by IIS or it can be a service hosted in an application. The messages we are sendign can be simple or XML, or as complex as a stream of BINARY data.
It provides integration and interoperability with existing .NET Framework distributed systems technologies such as Message Queuing (MSMQ), COM+, ASP.NET Web services, Web Services Enhancements (WSE), and a NUMBER of other functions.
It is a Software development kit for developing services on Windows. WCF is introduced in .NET 3.0. in the System.ServiceModel NAMESPACE. WCF is based on basic concepts of Service oriented ARCHITECTURE (SOA).
WCF unifies ASMX, Remoting, and Enterprise Services stacks and provides a single programming model. WCF services are interoperable and supports all the core Web services standards. WCF services also provide extension points to quickly adapt to new protocols and updates and integrates very easily.

21.

different ways to host wcf services

Answer»

Below are the some very popular methods to HOST WCF SERVICES in your applications
1) Self Hosting in managed applications
2) WINDOWS Service
3) IIS
4) WIndows PROCESS Actiation Service (WAS)