How Do You Unify All These Technologies?

Most of these distributed technologies are based on the same concept. However, all of them provide specific services that are unique to the product. (That is, if you want to do queuing, you need to use MSMQ or System.Messaging; if you want to do transactions, you need to use System.EnterpriseServices; if you need to do security, you need to use WSE.) As a programmer, you are constantly forced to switch between these programming models.

Therefore, we need one distributed technology to gather the capabilities of the existing stack and provide a solution with a simple and flexible programming model. WCF does a great job of providing a unified programming model wherein you can compose all these different functionalities into your application without having to do a lot of context switching. Going forward, you have to just learn one programming model—WCF. If you want queuing, you just add an attribute to your WCF service contract that makes it queued. If you want to secure the communication with your WCF service, you just add the appropriate security attributes for authentication and privacy. If you are after transaction support, you just add the transaction attribute. This new programming paradigm should help you concentrate more on the business logic.

WCF provides a single programming model to leverage the features of any distributed technology in the stack, as shown in Figure 2-9. Though WCF takes the best features of all the distributed technology in the stack, the team developing WCF has not chosen to extend any of the existing distributed technologies; instead, the whole infrastructure has been revamped to support the predecessors and use the classes available in the .NET Framework 3.0. Developers now can select the features they need to incorporate into the component. (That is, the developer can choose to implement security and reliability without requiring the transaction support.)

Unification of existing technology

Programming bugs are common in development environments. During testing, you can trap runtime errors by debugging the code. But finding bugs during the product environment is not as easy. You need the appropriate tools to help in instrumentation and in monitoring the health of an application. Tracing is a process to receive informative messages about the execution of a web application. In ASP.NET, tracing takes place through the methods available in the Trace class residing in the Systems.Diagnostics namespace. WCF extends the tracing capabilities of ASP.NET with lots of new features. WCF has also come up with end-to-end tracing through a trace viewer called svcTraceViewer.exe and also with message logging in the XML files.

NOTE

Chapter 6 covers tracing in more detail.

WCF also has the queue management that is similar to queued components of COM+ and extends the API of MSMQ. With the queue management features of WCF, developers no longer need to write complex plumbing code of sending and receiving queues in the application. WCF comes with NetProfileMsmqBinding and other custom bindings to interact with queues. It also resolves the ability to handle corrupted message that was a nightmare for many MSMQ developers. Contrary to MSMQ, the queue management of WCF also supports application-to-application security and does not require Active Directory. WCF supports queue management through bindings, and you can decide the appropriate binding depending on the consuming application's requirements.

NOTE

For more information about queue management, please refer to Chapter 8.

Writing a WCF application is similar to writing another application; you don't need to be concerned with the protocols or transport being used. Service endpoints that are the combination of address, binding, and contract (commonly known as the ABCs of WCF) can be specified in the configuration file that is separate from the service being developed. Endpoints are not a new concept. They were earlier defined in WSDL, but WCF extends this extensible model to other technologies such as Enterprise Services, thus giving a consistent model to its predecessors.

NOTE

Chapter 3 covers the ABCs of WCF in more detail.

Services can now have multiple endpoints. These endpoints either can be defined in the code or can be defined in the configuration file. WCF can facilitate bindings changes without impacting the code using configuration files.

..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset