WCF



1. What is WCF ?  

Windows Communication Foundation is a framework for building Service Oriented Application(SOA).It was introduced in .Net Framework 3.0 and is basically a combined feature of WebService,Remoting,MSMQ and COM+.


2. What is WCF ?  

Windows Communication Foundation is a framework for building Service Oriented Application(SOA).It was introduced in .Net Framework 3.0 and is basically a combined feature of WebService,Remoting,MSMQ and COM+.


3. Difference between Webservice and WCF ?  

->WebService cab be hosted only in IIS WCF can be hosted in IIS,windows Service,Self hosting and windows activation service. ->WebService can be accessed only through http protocol. WCF cab be accessed through http,tcp,MSMQ and named pipes. ->WebService works in stateless env. WCF can maintain states and sessions. ->Webservice uses System.Xml.serialization name space for serialization. WCF uses System.Runtime.Serialization namespace for serialization


4. What is .svc file?  

Its the file where service is defined and it will be the point of contact from the consumers.It contains name of service and code behind file name.It is used to know about the service.



5. What are different ways in which WCF can be hosted ?  

The different hosting techniques are 1.IIS hosting--This is the most commonly used hosting technique.Here IIS is used as a server and has following advantages -> starts automatically on the first client request,process recyling. Disadvantage-- It supports only http protocol 2.Self hosting-This is hosting the WCF urself either in console/windows application also in windows service . The host process should be running before a client makes a call to servc. Its easier to debug and deploy. Lifetime of services can be controlled using Open and Close methods. 3. WAS hosting(Windows Activation Server hosting)--WAS was introduced with windows vista and it is shipped with IIS 7.0. it is more powerful than IIS 6.0 as it can support http,tcp and named pipes whereas IIS 6.0 can support only http. 4.Windows Service Hosting--Here the service can be programmed to start when the system starts.


6. .What do you mean by ABC in WCF ?  

ABC in WCF means - Address -> A stands for Address. It indicates where you service is located.A URL is used to point to the location.Depending on whethere the service is hosted in http,tcp... the address varies. eg- http://localhost/Test net.tcp//localhost/Test Binding ->B stands for Binding which specifies how the client should communicate with the service. Contract->C stands for contracts. It exposes the operation provided by the Service. It is a contract.


7. What is an endpoint in WCF ?  

ABC together constitute an endpoint.Endpoint provides the client access to the functionality exposed by the service.


8. Whats the diff between Message Contract and Data Contract.  

Data contracts are used to describe data types used by service.They can be either parameter or return type. Message Contract are used to describe SOAP message format.They allow us to cotnrol the detail is SOAP header and body.


9. What namespace is used to access WCF ?  

System.ServiceModel


10. What are the main components of WCF?  

1.Service Class--functional class using any .net language. 2.Hosting environment--IIS,windows service etc 3.Endpoint--ABC


11. what is proxy in WCF?  

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 can call different methods in the service.


12. .What are two method in which you can access WCF?  

By Adding it as reference -- this will automatically generate the channel required for you to communicate with WCF. By creating channel manullay- use ChannelFactory. however the second method should be preferred one as pointed out in below article


13. How do you achieve method overloading in WCF?  

By making use of name property in OperationContract [ServiceContract] interface ISimpleCalculator { [OperationContract(Name="Add2numbers")] int Add(int a,int b) [OperationContract(Name="AddDouble")] int Add(double a,double b) }


14. Why normal method overloading is not possible in WCF ?  

Because WSDL is not a OO language and it does not support OOPs concept.


15. What is service and client in perspective of data communication?  

A service is a unit of functionality exposed to the world.

The client of a service is merely the party consuming the service.



16. 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)


17. What is binding 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.


18. Explain Basic binding in WCF.  

Offered by the BasicHttpBinding class, this is designed to expose a WCF service as a legacy ASMX web service, so that old clients can work with new services. When used by the client, this binding enables new WCF clients to work with old ASMX services.


19. What is TCP binding in WCF ?  

Offered by the NetTcpBinding class, this uses TCP for cross-machine communication on the intranet. It supports a variety of features, including reliability, transactions, and security, and is optimized for WCF-to-WCF communication. As a result, it requires both the client and the service to use WCF.


20. What is Peer network binding ?  

Offered by the NetPeerTcpBinding class, this uses peer networking as a transport. The peer network-enabled client and services all subscribe to the same grid and broadcast messages to it.


Java Interview Question

.Net Interview Question

PHP Interview Question

AngularJS Interview Questions