WCF Interview Questions Part_2

Previous Questions                                                                                 Next Questions

4)      What are the main components of WCF?
Ans)
            The main components of WCF are

1. Service class
2. Hosting environment
3. End point
----------------------------------------------------
5)      Can you explain how End points, Contract, Address and Bindings are done in WCF?
Ans)
All communication with a Windows Communication Foundation (WCF) service occurs through the endpoints of the service. Endpoints provide clients access to the functionality offered by a WCF service.
            Each endpoint consists of four properties:
ñ An address that indicates where the endpoint can be found.
ñ A binding that specifies how a client can communicate with the endpoint.
ñ A contract that identifies the operations available.
ñ A set of behaviors that specify local implementation details of the endpoint.
Example for Create EndPoints:
This example we explain with TCP Binding  binding type & class for this one is NetTcpBinding
string urlService=  “HostName”;
NetTcpBinding tcpBinding = new NetTcpBinding();
tcpBinding.TransactionFlow = false;
tcpBinding.Security.Transport.ProtectionLevel =                             System.Net.Security.ProtectionLevel.EncryptAndSign;
tcpBinding.Security.Transport.ClientCredentialType = TcpClientCredentialType.Windows;
tcpBinding.Security.Mode = SecurityMode.None; // <- Very crucial
                
 // Add a endpoint
syntax :: host.AddServiceEndpoint(contract,Binding,Address)
host.AddServiceEndpoint(typeof(Method or class for access your service), tcpBinding, urlService);

-------------------------------------
6)What is a service class?
Ans) Service class means a .cs file, it contains the Servicecontract,DataContract & Operationcontract.
Service class is contains Endpoints.


Previous Questions                                                            Next Questions