Chapter 5: WCF Interview Questions and Answers. – years of experience his rick skill set includes designing, integrating, implementing, ORM. musicmarkup.info WCF Interview Questions and Answers for freshers pdf 1. What is WCF? 2. Top 14 wcf interview questions and answers If you need top 7 free ebooks . Interview questions and answers – free pdf download Page 2 of 24; 3. . In this section, the author shares his experience and useful tips to exploit.
|Language:||English, Spanish, Arabic|
|Genre:||Health & Fitness|
|ePub File Size:||29.33 MB|
|PDF File Size:||9.73 MB|
|Distribution:||Free* [*Sign up for free]|
In this article you will learn about WCF Interview Questions and Answers. Top 23 WCF Interview Questions & Answers. 1) Explain what is WCF? WCF ( Windows Communication Framework) is Microsoft framework to make inter- process. WCF is a distributed technology that provides a single, integrated platform or model called the service model to develop distributed applications for Windows.
WCF is part of. NET 3. NET 2. It extends the. NET Framework to enable developers to build secure and reliable transacted Web services that integrate across platforms and interoperate with existing investments. Windows Communication Foundation combines and extends the capabilities of existing Microsoft distributed systems technologies, including Enterprise Services, System.
This contains the location of the service and transport schemas. The sample address for above transport schema may look like.
In WCF, all services expose contracts. The contract is a platform-neutral and standard way of describing what the service does. Describe which operations the client can perform on the service.
There are two types of Service Contracts. ServiceContract - This attribute is used to define the Interface.
OperationContract - This attribute is used to define the method inside Interface. Define which data types are passed to and from the service. WCF defines implicit contracts for built-in types such as int and string, but we can easily define explicit opt-in data contracts for custom types. There are two types of Data Contracts. DataContract - attribute used to define the class DataMember - attribute used to define the properties. Define which errors are raised by the service, and how the service handles and propagates errors to its clients.
Allow the service to interact directly with messages. Message contracts can be typed or untyped, and are useful in interoperability cases and when there is an existing message format we have to comply with.
Every WCF services must be hosted somewhere. There are three ways of hosting WCF services. What is binding and how many types of bindings are there in WCF? A binding defines how an endpoint communicates to the world.
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. 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. 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.
Offered by the NetNamedPipeBinding class, this uses named pipes as a transport for same-machine communication. It is the most secure binding since it cannot accept calls from outside the machine and it supports a variety of features similar to the TCP binding.
Offered by the WSDualHttpBinding class, this is similar to the WS binding except it also supports bidirectional communication from the service to the client. For WCF binding comparison, see http: Every service must have Address that defines where the service resides, Contract that defines what the service does and a Binding that defines how to communicate with the service.
The Endpoint is the fusion of Address, Contract and Binding. WCF 3. The below code shows how to expose a RESTful service. What is the address formats of the WCF transport schemas?
Address format of WCF transport schema always follow.
When a port number is not specified, the default port is We can only open a named pipe once per machine, and therefore it is not possible for two named pipe addresses to share a pipe name on the same machine.
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: 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.
The default proxy filename is output. SvcUtil http: 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:. WCF Services client configuration file contains endpoint, address, binding and contract. A sample client config file looks like. Transport reliability such as the one offered by TCP offers point-to-point guaranteed delivery at the network packet level, as well as guarantees the order of the packets.
Transport reliability is not resilient to dropping network connections and a variety of other communication problems. Message reliability deals with reliability at the message level independent of how many packets are required to deliver the message. Answer: We have our project it may be Windows or a web application or something else and we want to host one WCF service within this solution locally.
This type of hosting is called Self-Hosting.
To implement self-hosting we need to include System. ServiceHost namespace. The following are the advantages of self-hosting: Is easy to use: With only a few lines of code you have your service running. Is easy to debug: Debugging WCF services that are hosted in a self-hosted environment provides a familiar way of debugging, without having to attach to separate applications that activate your service.
Is easy to deploy: In general, deploying simple Windows applications is as easy as xcopy. You don't need any complex deployment scenarios on server farms, and the like, to deploy a simple Windows application that serves as a WCF ServiceHost. Supports all bindings and transports: Self-hosting doesn't limit you to out-of-the-box bindings and transports whatsoever.
The following are the disadvantages of self-hosting: Limited availability: The service is reachable only when the application is running. Limited features: Self-hosted applications have limited support for high availability, easy manageability, robustness, recoverability, versioning, and deployment scenarios. At least, out-of-the-box WCF doesn't provide these, so in a self-hosted scenario you have to implement these features yourself; IIS, for example, comes with several of these features by default.