Monday, August 26, 2013

Windows Communication Foundation Construct

Service Class

It is a construct that exposes one or more contracts through endpoints, with each endpoint exposing one or more service operations. A service class must implements at least one service contract, which defines the operations this service exposes. The class might also provide an explicit data contract, fault contract, which defines the data and errors for exposed operations of the service.

Support for Transactions

Handling transactions is an important aspect of building many kinds of business logic. Yet using transactions in a service-oriented world can be problematic. Distributed transactions assume a high level of trust among the participants, so it often isn’t appropriate for a transaction to span a service boundary. Still, since there are situations where combining transactions and services make sense, WCF includes support for this important aspect of application design. WCF-based applications can use the types inSystem.Transactions directly, or they can control transactions using WCF-defined attributes that rely on System.Transactions under the covers. In the first option, a method marked with the OperationContract attribute might wrap its work in a transaction using TransactionScope

Selecting a Host

A WCF service class is typically compiled into a library. By definition, all libraries need a host Windows process to run in. WCF provides two main options for hosting libraries that implement services. One is to use a host process created by either Internet Information Services (IIS) or a related technology called the Windows Activation Service (WAS). The other allows a service to be hosted in an arbitrary process.

o   IIS-hosted WCF services can only be accessed using SOAP over HTTP. No other transport protocols are supported.
o   WAS doesn’t require a Web server to be installed on the system, WCF services can be accessed over TCP.


Endpoint is a construct at which messages are sent or received (or both).

What are ABC’s of WCF ? 
A. Address - Address is a location that defines where messages can be sent
B. Binding - Binding is a specification of the communication mechanism (a binding) that described how messages should be sent
C. Contract - Contract is a definition for a set of messages that can be sent or received (or both) at that location (a service contract) that describes what message can be sent.

System-provided Bindings available with WCF

1)      BasicHttp
o    ASP.NET Web services (ASMX), version 1.
o    Web Service Enhancements (WSE) applications.
o    Basic Profile as defined in the Web Services Interoperability (WS-I) specification
o    Basic security profile as defined in WS-I.
2)      WSHttpBinding
o    HTTPS transport security.
o    WS-Security specifications.
o    HTTPS transport protection with SOAP message credential security for authenticating the caller.
3)      WSDualHttpBinding
o    WS-Reliable Messaging for reliability.
o    WS-Security for transfer security and authentication.
o    Uses HTTP for message delivery.
o    Uses text/XML message encoding.
4)      NetTcpBinding
o    Transport-layer security.
o    Leverages Windows security for transfer security and authentication.
o    Uses TCP for transport.
o    Implements binary message encoding.
o    Implements WS-Reliable Messaging.
o    Message-layer security (using WS-Security).
o    Transport security with message credential.
5)      NetNamedPipeBinding
o    Uses transport security for message transfer and authentication.
o    Uses named pipes for message delivery.
o    Binary message encoding.
o    Encryption and message signing.
6)      MsmqIntegrationBinding
o    Optimized for creating WCF clients and services that interoperate with non-WCF MSMQ endpoints.
o    Security can be disabled.
o    MSMQ transport security.
7)      NetMsmqBinding
o    Security can be disabled (None).
o    MSMQ transport security (Transport).
o    SOAP-based message security (Message).
o    Simultaneous Transport and Message security (Both).
o    Client Credential Types supported: None, Windows, Username, Certificate, Issued Token.


Post a Comment