Click here to Skip to main content
15,867,834 members
Articles / Programming Languages / C#
Article

WCF Basics

Rate me:
Please Sign up or sign in to vote.
1.17/5 (26 votes)
17 Aug 20062 min read 48.6K   11   6
An article about the basics of Windows communication foundation

Introduction

Windows communication foundation provides the next generation of distributed communication on the basis of service oriented programming model. This articles gives you an overview of service orientation through WCF.

Background

Current distributed system is mainly based on 4 different communication stacks.

  • ASP.NET Web Services (ASMX) along with the Web Service Enhancements (WSE) extensions to build powerful service oriented application which enables cross platform interoperability and integration.
  • The Microsoft Message Queue (MSMQ) enables transaction integration across multiple parties.
  • The Enterprise Services/COM+ runtime environment
  • .NET Remoting for communication with object across application domain boundaries.

Here the problem is about a single functional specification can take up to 4 implementations. That is, one implementation for each stack client. The implementation strategy for ASMX is quite different from that of Enterprise Services. Each stack client comes with its own architecture and API’s. Above all, COM+, Remoting and MSMQ are specific to Windows platform. Stateless nature of web service limits it’s from enabling context flows and call backs across platform boundaries. So, WCF is all about providing a single programming model that unifies the features of ASMX, MSMQ, Enterprise services and Remoting hence providing interoperability across platforms. Since WCF provides all of the features of these existing Microsoft technologies, WCF supports all of the scenarios currently supported by these technologies. In addition, WCF enables new scenarios that are currently not possible or very hard to implement with existing technologies because WCF allows you to compose functionality across these existing technologies. For example, this means that you’ll be able to achieve secure, reliable, transacted Web services by combining/composing the functionality that previously existed in silos.

Code sample

C#
// Add "plugin" to speak to SOAP clients
BasicHttpBinding bhb = new BasicHttpBinding(BasicHttpSecurityMode.None);
host.AddServiceEndpoint(typeof(IBasicService), bhb, "WCF_BasicService_SOAP");

// Add "plugin" to speak to TCP clients
NetTcpBinding tcp = 
   new NetTcpBinding(System.ServiceModel.Channels.SecurityMode.None);
host.AddServiceEndpoint(typeof(IBasicService), tcp, 
                        "net.tcp://localhost/ WCF_BasicService_TCP");

So if you want to expose your service via HTTP and use SOAP 1.1 for maximum interoperability, and also want to expose it via TCP using a binary wire encoding for maximum performance, the two resulting endpoints can reside side-by-side on top of the very same service. WCF is a vendor neutral model based on web service stack (WS-*) defined by http://www.ws-i.org which enables transactions across windows to non-windows platform. In addition to this, WCF provides state management across platform boundaries and call backs over HTTP.

History

:-) Here goes my second article.

License

This article has no explicit license attached to it but may contain usage terms in the article text or the download files themselves. If in doubt please contact the author via the discussion board below.

A list of licenses authors might use can be found here


Written By
Web Developer
United States United States
Presently working with US Technology Resources, Trivandrum.

Comments and Discussions

 
GeneralMy vote of 1 Pin
fayaz_3e17-Sep-10 5:05
fayaz_3e17-Sep-10 5:05 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.