WCF Overview


WCF combines the functionality from ASP.NET Web services, .NET Remoting, Message Queuing, and Enterprise Services. What you get from WCF is:

  • Hosting for components and services: Just as you can use custom hosts with .NET Remoting and WSE, you can host a WCF service in the ASP.NET runtime, a Windows service, a COM+ process, or just a Windows Forms application for peer-to-peer computing.

  • Declarative behavior: Instead of the requirement to derive from a base class (this requirement exists with .NET Remoting and Enterprise Services), attributes can be used to define the services. This is similar to Web services developed with ASP.NET.

  • Communication channels: Although to .NET Remoting is very flexible with changing the communication channel, WCF is a good alternative because it offers the same flexibility. WCF will offer multiple channels to communicate using HTTP, TCP, or an IPC channel. Maybe a UDP channel (SOAP over UDP is discussed earlier) will be available, too.

  • Security infrastructure: For implementing platform-independent Web services, a standardized security environment must be used. The proposed standards are implemented with WSE 2.0, and this will continue with WCF.

  • Extensibility: .NET Remoting has a rich extensibility story. It is not only possible to create custom channels, formatters, and proxies; it is also possible to inject functionality inside the message flow on the client and on the server. WCF will offer similar extensibilities, however here the extensions are created by using SOAP headers.

  • Support of today's technologies: Instead of rewriting a distributed solution completely to make use of WCF, WCF can integrate with existing technology. A channel offered by WCF is communicating with a serviced components using DCOM. Web services developed with ASP.NET can be integrated.

WCF has a very flexible layered architecture. Distributed applications can be written using a high-level API or a low-level API. The high-level API or service layer can be used to invoke methods and events. The service layer converts these high-level abstractions into messages to use channels and ports from the lower-level API.

Figure 32-6 shows the layers of a WCF application. The application can use messaging services such as queuing, routing, eventing, and discovery. Examples of service behaviors offered to distributed applications are automatic transactions, concurrency management, error handling, and instance creation. The messaging block is divided into two areas: transport channels, which are adapters that connect to transport protocol (for example, HTTP, TCP, UDP, and IPC), and channels that add additional functionality such as security, reliability, and eventing. Transport channels can be combined with other channels. The hosting environment section shows that WCF can be hosted in any application type. WCF services can be offered from ASP.NET, Windows Services, COM+, or in custom executables. This is very similar to.NET Remoting.

image from book
Figure 32-6

Figure 32-7 shows how different parts of a WCF application interact. A message is sent to a named port. The transport channel associated with the transport protocol forwards the message to the channel where the message is dispatched to the service.

image from book
Figure 32-7

Sending messages can be done in three different ways:

  • Datagram Messaging: datagram messages are sent in a "fire-and-forget" way. The message is sent and no answer is expected from the receiver. For the sender there's no need to wait for an answer from the receiver. Of course with such operations the methods may only have input parameters.

  • Request-Reply Messaging: request-reply messaging is the mostly used scenario. The sender sends a request message to the receiver, and the receiver returns a reply message.

  • Duplex Messaging: with duplex messaging both sides on the network act as a sender and receiver.




Professional C# 2005
Pro Visual C++ 2005 for C# Developers
ISBN: 1590596080
EAN: 2147483647
Year: 2005
Pages: 351
Authors: Dean C. Wills

flylib.com © 2008-2017.
If you may any questions please contact us: flylib@qtcs.net