Take the 2-minute tour ×
Programmers Stack Exchange is a question and answer site for professional programmers interested in conceptual questions about software development. It's 100% free, no registration required.

My questions are:

  1. What is the difference between WCF service and a simple Web service in .NET Framework?

  2. What a WCF Service can do which a .NET Web service cant? In other words, what are the limitation of .NET Web services which were overcome in WCF services?

I understand that WCF are REST based and .NET web services are SOAP based. But I need to know more than that. How a developer will make a design decision whether to developer a Web service or a WCF service?

share|improve this question
add comment

4 Answers

up vote 1 down vote accepted

Here is the basic difference between the two -

1 File Format/Extension :

i) ASP.net service - '.asmx'

ii) WCF service - '.svc'

2 Hosting :

i) ASP.net service - Can be hosted in IIS also can be hosted in a Windows Service.

ii) WCF service - Very flexible, can be hosted in IIS, Windows Activation Services(WAS), Managed Windows Services and It also supports Self-Hosting.

3 Transport Protocols/Binding :

i) ASP.net service - It supports HTTP & TCP protocols along with custom binding.

ii) WCF service - supports HTTP, WS-HTTP, TCP, Custom, Named Pipes, MSMQ & P2P(Point to Point) etc.

4 Data Transformation :

i) ASP.net service - XML serializer for Data Transformation.

ii) WCF service - DataContractSerializer for Data Transformation.

5 Serialization NameSpace :

i) ASP.net service - System.XML.Serialization

ii) WCF service - System.RunTime.Serialization

6 Supported Operations :

i) ASP.net service - only One-Way and Request-Response type.

ii) WCF service - Includes One-Way, Request-Response and Duplex.

7 Encoding :

i) ASP.net service - It uses following encoding mechanisms - XML1.0, MTOM (Message Transmission Optimization Mechanism), DIME (Direct Internet Message Encapsulation)

ii) WCF service - It uses following encoding mechanisms - XML1.0, MTOM, Binary

Read more differences - http://www.csharptutorial.in/2012/01/cnet-difference-between-web-service-and.html

share|improve this answer
add comment

The major difference is that things like binding are configurable through the config files - you can change from http to tcp or anything else just by editing your config. Same with a lot of parameters (buffer sizes etc).

There is absolutely no reason to create simple web services if you have the option of using WCF.

share|improve this answer
    
I have been building regular .Net web services and using app.config file to load connection string , provider types etc and other static yet secure data. So how WCF plays a role here? If you could elaborate on your point a bit, it will help me understand the concept. Thanks. –  Steve Johnson Dec 24 '10 at 19:45
add comment

What a WCF Service can do which a .Net Web Service cant?

One of the things we learned (the hard way) was that WCF lets you modify messages before they are transmitted or after they are received. We had an issue where nothing we were able to do to deserialize fault messages was working, so we had to create a message handler to inspect incoming messages for faults and then throw the relevant exception. Sample.

share|improve this answer
add comment

both webservices and wcf services serve the same purpose: they allow you to call a service-function on an other remote machine in a similar way you would call a local function.

A soap-webservice does this using http(s)-internettransportprotocol and formatting the message to the remote machine and the answer from the remote machine in the xml-soap-format.

this is not the only way to do remote-procedure-calls.

In the java world there is rmi (remote method invocation), in dotnet there is "dot net remoting"

wcf is an abstraction that alow remote-procedure-calls with several different formats among these are:

  • soap-webservice
  • rest-webservice
  • dot net remoting

you write the wcf-service or client code once and by configurationfile you decide which remoting mechanism will be used.

A simple dotnet soap-webservice is much easier to write and it requires a microsoft internet information server as a host.

A WCF-Service (or WCF-Client) is more complicated to understand/learn but much more flexible if you want to change the remote-provider. A WCF can become a selfhosted SOAP-Webservice so you do not need a msie.

share|improve this answer
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.