34

I am working on a new project. Is there any benefit with going with a WCF web service over a regular old fashion web service?

Visual Studio offers templates for both. What are the differences? Pros and cons?

John Saunders
  • 160,644
  • 26
  • 247
  • 397
jdiaz
  • 7,354
  • 12
  • 42
  • 51
  • 9
    WCF has an incredibly large learning curve, make no mistake. Yeah, you can get a service running not-too-hellishly with some copy&paste and filling the blanks but it will take most developers months before they understand what all that configuration and setup actually does. – Sander Apr 09 '10 at 09:04
  • 2
    Most developers don't _need_ to understand all the configuration, and besides, this has changed radically with .NET 4.0. – John Saunders Jun 20 '12 at 17:32
  • I can vouch for the fact that it is a steep learning curve. WCF is almost Byzantine. I've been studying it for about a month and I'm only starting to get my head around it. There are lots of complexities around different security methods, different types of digital certificates and client/server validation. There are lots of very good video tutorials around. Have a look on questpond.com. I can't remember ASMX being quite as harrowing but WCF does seem like it is quite powerful and that it has been worth the effort. – Guru Josh May 07 '14 at 15:23

7 Answers7

33

What is a "regular old fashioned web service?" An ASMX service, or are you using WSE as well? ASMX services are not naturally interoperable, don't support WS-* specs, and ASMX is a technology that is aging very quickly. WSE (Web Service Enhancements) services DO add support for WS-* and can be made to be interoperable, but WCF is meant to replace WSE, so you should take the time to learn it. I would say that unless your application is a quick an dirty one-off, you will gain immense flexibility and end up with a better design if you choose WCF. WCF does have a learning curve beyond a [WebMethod] attribute, but the learning curve is over-exaggerated in my opinion, and it is exponentially more powerful and future proof than legacy ASMX services.

Unless your time line simply cannot tolerate the learning curve, you would be doing yourself a huge favor learning WCF instead of just sticking with ASP.NET Web Services. Applications will only continue to become more and more distributed and interconnected, and WCF is the future of distributed computing on the Microsoft platform.

Here is a comparison between the two.

Nathan
  • 12,290
  • 3
  • 29
  • 28
9

The Pros of doing all by yourself is:

  • No learning curve
  • Very flexible

The Pros of WCF are:

  • Costs less time in the longer run
  • Switch protocols without programming

A disadvantage of WCF: some static property names can be pretty lengthy...

To summarize: WCF lets you focus on programming, but you need to learn it first ;-)

doekman
  • 18,750
  • 20
  • 65
  • 86
3

Pro for WCF : You don't need a web server (i.e. IIS). You actually don't need a server OS.

Andrei Rînea
  • 20,288
  • 17
  • 117
  • 166
2

I like the fact writing WCF services makes it easy to separate your service from the implementation. You can write your service and then host it in IIS, a console application, or a Windows service; you can also talk to it via HTTP, net TCP, etc.

Peter Mortensen
  • 30,738
  • 21
  • 105
  • 131
Esteban Araya
  • 29,284
  • 24
  • 107
  • 141
1

Unit tests on your services implamentation and interaction are easier to do !

Nicolas Dorier
  • 7,383
  • 11
  • 58
  • 71
0

If your project is using framework 4.0, Why don't your try WebApi, which is easy to understand and uses the convention over configuration.

Its a great way of building application with super fast interfaces

Have look at the getting started videos from MS, It has evolved from WCF data Services.

http://www.asp.net/web-api/overview/getting-started-with-aspnet-web-api

Matt
  • 2,866
  • 2
  • 17
  • 16
-2

In my experience

WCF

It is absurdly verbose to work with it, it is not quite compatible with other microsoft products and, of course, it is not widely accepted outside ot the microsoft world.

But my main problem is it is not stable, it trends to fail (in some situation) and it requires to tweak it before it can be used.

Instead

SOAP (aka standard Webservice), it works, it is easy to work and it is widely compatible (Java-JAX accepts it without any modification).

To add authentication in SOAP could be a bit tricky but not impossible.

magallanes
  • 6,583
  • 4
  • 54
  • 55
  • 4
    -1 for misinformation and unsubstantiated opinion. I can only assume you're talking about configuration when you say that WCF is "verbose", in which case, you should start using .NET 4.0 or 4.5. "Not compatible with other Microsoft products" should be substantiated if you want to be taken seriously. But you lose all credibility by contrasting WCF with SOAP. – John Saunders Jun 20 '12 at 17:31
  • @John Saunders, so you are trolling me without any reason. sheesh guy. And no, even in net 4.0, wcf is still half baked. Anyways, WCF is vendor locked. – magallanes Jun 21 '12 at 15:28
  • 1
    Youb clearly have no idea what you're talking about. "Vendor locked" is obvious nonsense. You can correct my opinion by presenting facts and not rants. – John Saunders Jun 21 '12 at 16:10
  • You can use WCF in many ways: With http/SOAP you get a wsdl to generate client code automatically with most technologies which is neat if your service should be public. For internal services net.tcp and even MSMQ are an option - you can lock yourself in, if you insist to do so. – mbx Nov 23 '12 at 14:07
  • What i can do with WCF that i can't do with SOAP?. – magallanes Nov 27 '12 at 16:36