What is needed for backward compatibility?
Service versioning is used for backward compatibility for the current customers. For the modification of the service for the uncertain needs of the occupation or to solve an issue after the primary deployment of the WCF service.
Describe Concurrency Management? And its types?
It is used to handle multiple threads and to command by the System.ServiceModle.ServiceBehaviourAttribute. It identifies the number of concurrent requests is hold by service instances and to make thread-safe. Types are Single, Multiple, Reentrant concurrency Mode.
Define Instance Management?
“A group of messages on the client request for immediate service is considered as Instant management. It is used to support the incoming service request and the management of services. These are three ways for Instant management?
Per call
Per Session
Single”
WCF Interview Questions
Define Endpoints?
By the use of endpoint WCF gives the services to the customers. Endpoints give the important means and the guidance to the customer for interacting with different services.
Tell the various transport of Duplex contracts? Define
Duplex messaging is for interacting with the customer by call back process. Various transport such as HTTP, TCP, named pipes. A customer and servers can independently interact with each other by one way and Request-Reply contract.
Define Binding in WFC?
Binding tells us about the manner in which the service and the customer will interact with one another by binary or text A binding should have a transport element ad a message coding element.
Advance WCF Interview Questions
Explain what is WCF?
WCF (Windows Communication Framework) is Microsoft framework to make inter-process communication easier. Through various means, it lets you do the communication like MS messaging Queuing, Services, Remoting and so on. It also allows you talk with other.NET apps, or non-Microsoft technologies (like J2EE).
Mention what are the main components of WCF?
“Main components of WCF are
Service: The working logic
Host: The path where the data is saved. E.g., .exe, process, windows service
Endpoints: The way the service is exposed to the outside world”
Explain how does WCF works?
WCF follows the “Software as a Service” model, where all units of functionality are defined as services. For communication, each point is a portal or connection either with the client or other services. It is a program that exposes a collection of endpoints.
WCF Interview Questions
Mention what is the endpoint in WCF and what are the three major points in WCF?
“Every service must have an address that determines where the service is located, contract that defines what the service does and binding that tells how to communicate with the service.
Address: It specifies the location of the service which will be like http://Myserver/Myservice. To communicate with our service client it will use this location
Contract: It specifies the interface between the server and client. It’s a simple interface with some attribute
Binding: It decides how two parties will communicate with each other in terms of transport and encoding and protocols”
List out what are the different isolation levels provided in WCF?
“The different isolation levels provided in WCF are
Read Uncommitted
Read Committed
Repeatable Read
Serializable”
What is REST and what is the problem with WCF REST and how it can be resolved?
REST stands for Representational State Transfer, for designing network application REST is used. It relies on a stateless, client server, cacheable communications protocol. The reason behind creating WCF is to support SOA and not REST. It requires a lot of configuration in order to create HTTP REST service using WCF. To overcome this tedious task, ASP.NET web API was introduced.
Advance WCF Interview Questions
Mention what are the various address format in WCF?
“The various address format in WCF are
HTTP Address Format: à http:// local host:
TCP Address Format:à net.tcp://local host:
MSMQ Address Format:ànet.msmq://localhost:”
Explain what is Data Contract Serializer?
The process of changing an object instance to a portable and transferable format is known as the Serialization, and serialization of data is referred as Data Contract Serializer.
List out the types of binding available in WCF?
“The types of binding available in WCF are
BasicHttpBinding
NetTcpBinding
WSHttpBinding
NetMsmqBinding”
WCF Interview Questions
Name the namespace that is used to access WCF service?
System.ServiceModel is used to access WCF service
What are the three types of transaction manager WCF supports?
“The types of the transaction manager that WCF supports are
Light Weight
WS- Atomic Transaction
OLE Transaction”
What are the types of Data Contracts in WCF?
“There are two types of Data Contracts
Data Contract: Attribute used to define the class
Data Member: Attribute used to define the properties”
Advance WCF Interview Questions
Mention what are the different instance modes in WCF?
“To a particular service instance WCF binds an incoming message request, so the available modes are
Per Call: This instance is created for each call, efficient in terms of memory but need to maintain session
Per Session: For a complete session of a user instance are created
Single: One instance is created which is shared among all the users and shared among all. In terms of memory it is least efficient.”
In WCF what are duplex contracts?
Duplex messaging or call-back is used in WCF to communicate with the client. Over different transport system Duplex messaging in WCF is done like TCP, Named pipe and even HTTP. Collectively this is known as duplex contracts in WCF.
Mention what are the ways of hosting a WCF service?
“The ways of hosting a WCF service are
IIS
Self-Hosting
WAS (Windows Activation Service)”
WCF Interview Questions
What are Service Oriented Design Principles?
“There are four Service-oriented principles (tenets) in SOA as given below :
Boundaries are explicit: This SOA principle states that a service can be deployed anywhere and be easily and freely accessed by other services, regardless of the environment or development language of the other services.
Services are autonomous: This SOA principle states that each service must be managed and versioned differently so that they do not affect other services in the process. Contracts, once published, should not be changed. Services need to be isolated and decoupled to accomplish the goal of making them autonomous.
Services share schema and contract, not class: This SOA principle states that services should not pass classes and types; they pass schemas (data) and contracts (behaviors). This allows for a loosely coupled system where the service does not care what type of environment the other service is executing on. The information being passed is 100% platform independent.
Service compatibility is determined based on policy: This SOA principle states that each service should have its own compatibility level and knows how it would interact with other services. Services look at each other’s policy, looking for similarities so that they can start communicating. If two services can’t satisfy each other’s policy requirements, they are not compatible with each other.”
What is SOAP?
“SOAP stands for Simple Object Access Protocol which is used for exchanging data in XML-based format over HTTP. SOAP is widely-used by web services for exchanging data. A simple SOAP message structure is given below:
WCF and Web Services Interview Questions and Answers
A SOAP message has an optional header and a required body element. A SOAP message header can contain the application-specific information like authentication or authorization etc. Also, a SOAP message header must be the first child element of the SOAP Envelope element. The SOAP body element contains the actual SOAP message. Moreover, SOAP is a combination of HTTP protocol and XML i.e. SOAP = HTTP + XML”
What is WS -* Protocols?
“The SOAP protocol is used for message exchange between Web Services. But SOAP defines very basic semantics for message headers. It does not always define meaning to the header. Hence to extend SOAP, WS-* protocols specifications have been developed with semantics which can then be reused in various application scenarios.
WS -* protocols are a set of protocols (means standards and specifications) that helps us to implement certain needs and behaviors of a service. These protocols describe how to exchange messages in a secure, transactional, and reliable way by using the headers in the SOAP message. WCF can implement the WS -* protocols by using WsHttpBinding. This binding makes use of some of the WS -* protocols and adds the needed behaviors, such as transactional message calls, reliability, discovery, and addressing.”
Advance WCF Interview Questions
What is WCF ABC?
“WCF ABC stands for Address, Binding, and Contract.
Address (Where)
WCF Address specifies to a specific location, where the service is hosted. A WCF Address is specified as a URI. URI’s first part specifies the transport protocol (HTTP, TCP, Net.pipe and MSMQ), and the other parts specify the host machine address and service path as shown in below fig.
WCF address example
Others sample Addresses are given below:
http://www.mywebsite/MyService
net.tcp://www.mywebsite/MyService
net.pipe://www.mywebsite/MyPipeService
net.msmq://www.mywebsite/MyMsMqService
Binding (How)
WCF binding specifies how the service and client will communicate with each other in terms of transport protocols and encoding (such as text or binary). WCF binding is a set of binding elements and each element specify, how the service and client will communicate with each other. Each binding must have at least one transport element and one message encoding element.
Contract (What)
WCF contract specifies what the service contains. WCF has five types of contracts: service contract, operation contract, data contract, message contract and fault contract. Each contract defines certain behavior.”
How to define multiple endpoints for a WCF service?
“A WCF service configuration with multiple endpoints is given below
A WCF service configuration with multiple endpoints is given below : <system.serviceModel> <services > <service name = “MyWCFService”> <endpoint address = “http://localhost:90/MyWCFService” binding = “wsHttpBinding” contract = “IMyWCFContract”/> <endpoint address = “net.tcp://localhost:91/MyWCFService” binding = “netTcpBinding” contract = “IMyWCFContract”/> </service> </services> </system.serviceModel> |
What are default Endpoints?
WCF offers some default endpoints to the service if a service host doesn’t define any endpoints but has at least one base address. For example, WCF uses the basic binding for the Http address.
WCF Interview Questions
What are standard Endpoints?
“WCF provides a set of pre-defined endpoints known as Standard Endpoints for metadata exchange, discovery and web. You can configure the standard endpoints by using a config file and programmatically. Here is the list of standard endpoints :
mexEndpoint
webHttpEndpoint
webScriptEndpoint
workflowControlEndpoint
announcementEndpoint
discoveryEndpoint
udpAnnouncementEndpoint
udpDiscoveryEndpoint”
What are the different WCF contracts?
“WCF contract specifies the service and its operations. WCF has five types of contracts:
Service contract
Operation contract
Data contract
Message contract
Fault contract.”
What are the various ways of hosting a WCF service?
“There are four ways of hosting a WCF service.
Self-Hosting
Windows services hosting
IIS hosting
Windows Activation Services hosting (WAS)”
Advance WCF Interview Questions
What is Binding?
WCF binding specifies how the service and client will communicate with each other in terms of transport protocols and encoding (such as text or binary). WCF binding is a set of binding elements and each element specify, how the service and client will communicate with each other. Each binding must have at least one transport element and one message encoding element.
What are the different types of bindings in WCF?
“WCF supports the following types of built-in bindings:
Basic binding
Web binding
Web Service (WS) binding
WS Dual binding
TCP binding
IPC binding
MSMQ binding
Federated WS binding
Peer Network binding
MSMQ integration binding”
What are the ways to create a WCF Client?
“There are two ways to create a WCF Client or calling a WCF Service as:
WCF Proxy
Channel factory”
WCF Interview Questions
What is Instance Management in WCF?
“WCF manages the session by creating the instance of the service class. This created instance(s) handle the incoming service request. In WCF, the session is the way of managing the services instance(s) so that the server can use these instances in an optimized way. At the server side, the InstanceContext class is used to manage service class instance. There are following instance management ways :
Per Call
Per Session
Single”
What is Concurrency Management in WCF?
Concurrency management is closely related to the Instance management in WCF but both are two different things. Instance management specifies how the service instances are created while Concurrency management specifies how many concurrent requests are handled by the service instances. By using concurrency, you can make your service instance thread-safe. By default, a per-call service instance is thread-safe since each request is served by a new service instance. A per-session service instance is not thread-safe since multiple requests of a client are served by a single service instance. Hence, it’s required concurrency management. A single service instance is not thread-safe since multiple requests of all clients are served by a single service instance. Hence, it’s required concurrency management.
What is Impersonation?
Impersonation is a way to authorize a caller (client) identity to access the service domain’s resources. The service resources may be local files or database tables and should be on the same machine on which service is hosted. By default, impersonation is disabled and resources are accessed by using the WCF service’s process identity.
Advance WCF Interview Questions
What is service versioning?
After the initial deployment of the WCF service, you may need to change the service for a variety of reasons like as changing business needs or fixing others issues. Each change in your existing service introduces a new version of the service. Service versioning is helpful in backward compatibility with your existing clients.
Give an example of Know Type.
“[KnownType(typeof(TestClassCar))]
[KnownType(typeof(TestClassTruck))]
[DataContract]
public class TestClassVehicle
{
}
[DataContract]
public class TestClassCar : TestClassVehicle
{
}
[DataContract]
public class TestClassTruck : TestClassVehicle
{
} “
What is “Know Types” in WCF?
The Know Type is an attribute which is used to the parent class because if you define the complex class as the property of class then it would be very difficult for the compiler during the de-serialization process.
WCF Interview Questions
What is the usage of “maxConcurrentCalls” in Throttling?
The “max Concurrent Calls” attribute in throttling is used to limit the total number of calls which are going to the service instances. Its default value is 16.
What is Throttling in WCF?
In WCF, “Throttling” is used to limit the sessions or instances to be created at an application level. It is used to boost the performance.
What is the address format in WCF?
Syntax of address format in WCF:
Advance WCF Interview Questions
What are the MEP in WCF?
“MEP stands for Message Exchange Pattern. There are three types of Message Exchange Patterns are allowed:
DataGram
Request and Response
Duplex”
What is Callback mode in WCF? Explain.
“The WCF callback mode is a special type of mode where WCF on the call back calls the method of client and in this scenario WCF service acts as a client and client acts as a service.
This mode is not supported by “”HTTP Binding”” so “”WSDualHttpBinding”” is used in this mode.
What is the one-way mode in WCF? Explain.
In WCF one-way mode, a client sends a request to the server but does not wait till the response comes. It does not care if the request is failed or succeeded. The Client will not be blocked in this case until it receives the response.
WCF Interview Questions