Get the latest news, exclusives, sport, celebrities, showbiz, politics, business and lifestyle from The VeryTime,Stay informed and read the latest news today from The VeryTime, the definitive source.

ASP.NET 4.5.1 Hosting :: Differences Between WCF and ASP.NET Web Services

41
What is WCF?

Windows Communication Foundation (Code named Indigo) is a programming platform and runtime system for building, configuring and deploying network-distributed services. It is the latest service oriented technology; Interoperability is the fundamental characteristics of WCF. It is unified programming model provided in .Net Framework 3.5. WCF is a combined feature of Web Service, Remoting, MSMQ and COM+. WCF provides a common platform for all .NET communication. WCF can create services similar in concept to ASMX, but has much more capabilities. WCF is much more efficient than ASP.Net because it is implemented on pipeline. WCF is more secure, reliable. As WCF is implemented on a different pipeline it does not have all Http capabilities (Http session, cache etc). WCF is a .NET 3.5 technology introduced by Microsoft. It unifies all communication options available in earlier versions of .NET framework. You can make a WCF application that would act exactly the same as a WebService, but it will be easier to implement and manage.

What is Web Services?

Web Service is an application that is designed to interact directly with other applications over the internet. In simple sense, Web Services are means for interacting with objects over the Internet. The Web serivce consumers are able to invoke method calls on remote objects by using SOAP and HTTP over the Web. WebService is language independent and Web Services communicate by using standard web protocols and data formats, such as HTTP, XML and SOAP.

Differences Between WCF and ASP.NET Web Services

1. In Web Services Web Service attribute will added  on the top of class. In WCF there will be a Service Contract attributes will be there. Same way Web Method attribute are added in top of method of Web service while in WCF Service Operation Contract will added on the top method.

2. In Web service System.XML.Serialization is supported while in the WCF Service System.RunTime.Serialization is supported.

3. System.Xml.Serialization namespace is used for serialization in webservice while System.Runtime.Serialization namespace is used for serialization in case of WCF.

4. WCF Services can be multithreaded via ServiceBehavior class while web service can not be.

5. WCF has been designed by Microsoft from the scratch to comply with SOA (Service Oriented Architecutre). while Webservices do not comply with the Service Oriented Architecutre.

6. WCF Services supports different type of bindings like BasicHttpBinding, WSHttpBinding, WSDualHttpBinding etc.while Web services only used soap or xml for this.

7. Web services are compiled into a class library assembly. A file called the service file is provided that has the extension .asmx and contains an @ WebService directive that identifies the class that contains the code for the service and the assembly in which it is located while in WCF.WCF services can readily be hosted within IIS 5.1 or 6.0, the Windows Process Activation Service (WAS) that is provided as part of IIS 7.0, and within any .NET application. To host a service in IIS 5.1 or 6.0, the service must use HTTP as the communications transport protocol.

8. WCF can be accessed via various protocols like SOAP over HTTP, Binary over TCP, Named Pipes, P2P, MSMQ etc. while webservices can only be accessed via HTTP.
 
9. [WebService] attribute has to be added to the class and [WebMethod] attribute to be added to the method exposed to client in case of webservice while [ServiceContraact] attribute is added to the class and [OperationContract] attribute is added to the method exposed to client in case of WCF.
Source...
Subscribe to our newsletter
Sign up here to get the latest news, updates and special offers delivered directly to your inbox.
You can unsubscribe at any time

Leave A Reply

Your email address will not be published.