WCF Interview Questions and Answers for Experienced Pdf - 1

Question: 1

What is throttling in WCF 4.0?

WCF throttling provides you some properties that help you to limit the number of instances and sessions that you can create at application level.

The three WCF throttling settings are:

MaxConcurrentCalls – Limits the total number of concurrent calls that you can process simultaneously across all service instances

MaxConcurrentSessions – Limits the total number of sessions that a single ServiceHost object can accept

MaxConcurrentInstances – Limits the total number of service instances that a ServiceHost object can create at one time.

Question: 2

What are the new features in WCF 4.0?

Routing Service – Acts as a broker or gateway to the services and can be implemented as a centralized security boundary in applications so that all the incoming messages can pass through it. The purpose of the routing service is to handle the messages over the WCF supported protocol. WCF 4.0 provides the RoutingService class to implement routing services in applications. The RoutingService class receives incoming messages and sends them to the target service.

Default configuration – Specifies that in WCF 4.0, you never need to have adequate knowledge of the configuration of WCF to define an endpoint, behavior and other settings of WCF 4.0, you do not need to manually configure the endpoints, behaviors and other settings, as these are automatically configured by WCF.

Support for discovery behaviors – Specifies that WS-Discovery is a technical specification, which is used to dynamically discover the location of the WCF service endpoints by defining SOAP based protocol.

Improved REST service development – Provides new feature for building the RESTful web services (now referred as WCF WebHttp services) using WCF. A RESTful web service is a service based on HTTP protocol and REST principles. The REST principles are defined by three categories with respect to a Web service. Can be accessed with a simple URI, Supports MIME types, Uses different HTTP methods

With the use of MIME types, different data formats, such as JavaScript Object Notation (JSON) and Extensible Markup Language (XML), can be returned from the WFC service.

Integration of WCF with WF – Refers to the support that has been added for the integration of WCF and WF.

Question: 3

What is an endpoint?

In WCF, services and clients communicate through endpoints. An endpoint is the point where the services and clients meet and exchange messages. The services expose their functionalities to the client through their endpoints. A single WCF service can have one or more endpoints. An endpoint comprises the following components:

Endpoint address – Refers to the address of the service, that is, where the service can be found. An endpoint address needs to be unique and is an object of the EndpointAddress class. The endpoint address needs to be Uniform Resource Identifier (URI) address and needs to include an Identity Object that represents the security identity of the service.

Binding – Refers to the means in which a client interacts with the endpoint. Binding encompasses the transport protocol and the encoding scheme used for communicating between the service and client.

Service contract – Refers to the set of functionalities and operations exposed by the service to the clients.

Behavior – Refers to the local implementation or behavior of the endpoint. For example, the endpoint can behave in such a way that it listens to the requests from clients at a particular URI address.

Question: 4

What do you understand by service identity?

WCF service identity is a value generated from the WSDL for the service at design time and sent to a client, which it uses to authenticate the service before requesting any operation of the service. The service identity is represented by the identity property of the EndpointAddress class. The ServiceModel Metadata Utility Tool (Svcutil.exe) allows you to access the service identity of a service. This tool generates a configuration file for the WCF service containing the service identity.

Question: 5

Explain the instancing model of WCF?

WCF consists of an instancing model that specifies how many instances of the WCF service are created and run at a particular time. Depending upon the number of instances created by the service, there are three types of services:

Per-Call service – Refers to the service that is created by every operation requested by a client, that is, every time a client requests for an operation, a new instance of the service is created. The per-call service can be called only when the client call is in progress. To specify a WCF service to behave as a per call service, the InstanceContextMode property of the ServiceBehavior attribute has to be set to PerCall.

Per-Session service – Refers to the WCF service that is created for each session between a client and service. The instance of a per-session service does not depend on other instances of the service and exists as long as the client needs it. Calls to the service, the InstanceContextMode property of the ServiceBehavior attribute has to be set to PerSession.

Singleton service – Refers to the WCF service that is created for the entire host application, that is, only one instance of the service is created for the entire lifetime of the application. This single instance of the service handles all the requests for the message at a time. When the host application ends, the instance of the singleton service is also destroyed. To configure a service as singleton, set the InstanceContextMode property of the ServiceBehavior attributes to single.

Related Questions