Introduction
Windows Communication Foundation (WCF) is a technology
combined with the features of XML Web Services and .NET Remoting, along with
some improvements. This article is a comparison of WCF with Web Services and
.NET Remoting.
Interoperability
- .NET Remoting works in a homogenous environment. A consuming application is also required to be in .NET.
- Web Services are platform and language independent, and don't care about the consuming application. But it has restrictions of the HTTP protocol. Performance-wise, they are considered slow.
- WCF can be hosted under the Windows environment, but it can be utilized by clients of different languages and different platforms.
Protocol
Utilization
- .NET Remoting applications can use the HTTP, TCP, and SMTP protocols.
- XML Web Services use SOAP, i.e., XML via HTTP.
- WCF, along with all these protocols, can use named pipes and MSMQ as well.
| 
Features | 
Web service | 
WCF | 
| 
Sample Code | 
[WebService] 
    public class Service :
  System.Web.Service.WebService 
    { 
        [WebMethod] 
        public string Test() 
        { 
            return "hey there"; 
        } 
    } | 
[ServiceContract] 
    public interface Itest 
    { 
        [OperationContract] 
            string ShowMessage(); 
    } 
    public class Service : Itest 
    { 
        public string ShowMessage() 
        { 
            return "Hey there"; 
        } 
    } | 
| 
Hosting | 
It can be hosted in IIS | 
It can be hosted in IIS, windows activation service,
  Self-hosting, Windows service | 
| 
Programming | 
[WebService] attribute has to be added to the class | 
[ServiceContract] attribute has to be added to the class | 
| 
Model | 
[WebMethod] attribute represents the method exposed to
  client | 
[OperationContract] attribute represents the method
  exposed to client | 
| 
Operation | 
One-way, Request- Response are the different operations
  supported in web service | 
One-Way, Request-Response, Duplex are different type of
  operations supported in WCF | 
| 
XML | 
System.Xml.serialization name space is used for
  serialization | 
System.Runtime.Serialization namespace is used for
  serialization | 
| 
Encoding | 
XML 1.0, MTOM(Message Transmission Optimization
  Mechanism), DIME, Custom | 
XML 1.0, MTOM, Binary, Custom | 
| 
Transports | 
Can be accessed through HTTP, TCP, Custom | 
Can be accessed through HTTP, TCP, Named pipes, MSMQ,P2P,
  Custom | 
| 
Protocols | 
Security | 
Security, Reliable messaging, Transactions | 
 
No comments:
Post a Comment