WCF related Interview Questions

WCF provides a runtime environment for services, enabling you to expose CLR types as services, and to consume other services as CLR types. WCF is part of .NET 3.0 and requires .NET 2.0, so it can only run on systems that support it.
Go here for more WCF related questions.

1.) What is Proxy and how to generate proxy for WCF Services?
The proxy is a CLR class that exposes a single CLR interface representing the service contract. The proxy provides the same operations as service's contract, but also has additional methods for managing the proxy life cycle and the connection to the service. The proxy completely encapsulates every aspect of the service: its location, its implementation technology and runtime platform, and the communication transport.

The proxy can be generated using Visual Studio by right clicking Reference and clicking on Add Service Reference. This brings up the Add Service Reference dialog box, where you need to supply the base address of the service (or a base address and a MEX URI) and the namespace to contain the proxy.

Proxy can also be generated by using SvcUtil.exe command-line utility. We need to provide SvcUtil with the HTTP-GET address or the metadata exchange endpoint address and, optionally, with a proxy filename. The default proxy filename is output.cs but you can also use the /out switch to indicate a different name.

SvcUtil http://localhost/MyService/MyService.svc /out:Proxy.cs

When we are hosting in IIS and selecting a port other than port 80 (such as port 88), we must provide that port number as part of the base address:

SvcUtil http://localhost:88/MyService/MyService.svc /out:Proxy.cs


2.) What attachments protocol will be used in Windows Communication Foundation?
SOAP Message Transmission Optimization Mechanism (MTOM) will be the attachment technology supported in Windows Communication Foundation.

3.) Does Windows Communication Foundation support both synchronous and asynchronous messaging?
Yes. Windows Communication Foundation supports multiple message patterns, including one-way, request/response, two-way (duplex), and queued.

4.) What specifications will Windows Communication Foundation support?
Windows Communication Foundation will support a broad range of Web services standards, including basic standards (XML, XSD, XPath, SOAP, WSDL) and advanced standards and specifications that comprise the WS-* architecture. These include WS-Addressing, WS-Policy, WS-Security, WS-Trust, WS-SecureConversation, WS-ReliableMessaging, WS-AtomicTransaction, WS-Coordination, WS-Policy, and MTOM.

5.) How are Windows Communication Foundation services hosted?
A class implementing a Windows Communication Foundation service is typically compiled into a library. By definition, all libraries need a host application domain and Windows process to run in. Windows Communication Foundation provides two options for hosting libraries that implement services. One is to use a host application domain and process provided by the Windows Activation Service (WAS), while the other allows a service to be hosted in any application domain running in an arbitrary process (such as a Windows Forms application, a console application, an NT Service, etc).

1 comment:

sandeep said...

Apart from using svcutil.exe or using Add service reference, you can create a proxy service manually using ChannelFactory,provided that you have access to the service contracts.

Great info though!!!