By user29440


2008-10-19 20:34:37 8 Comments

I'm new to .Net and do not understand the difference. Can someone point me in the right direction?

9 comments

@DOTNET Team 2014-04-12 08:47:07

Main Differences between Web service and WCF are listed below.

Web Service : Web Service is an application that is designed to interact directly with other applications over the internet.

1) [WebService] and [WebMethod] attributes defines a web service and methods.
2) It Can be accessed only over HTTP.
3) Hosted in IIS.
4) Support security services.
5) Can not be multithreaded.
6) Only Used Soap or XML.
7) System.Xml.serialization name space is used for serialization

WCF :Windows Communication Foundation (Code named Indigo) is a programming platform and runtime system for building, configuring and deploying network-distributed services.

1) [ServiceContract] and [OperationContract] attributes defines a web service and methods.
2) Accessed through HTTP, TCP, MSMQ, P2P, Named pipes
3) Hosted in IIS, Self-Hosting ,WAS and Windows Service.
4) Can be multithreaded via service behavior class.
5) System.Runtime.Serialization namespace is used for serialization
6) Supports different type of bindings like BasicHttpBinding, WSHttpBinding,WSDualHttpBinding etc.
7) Support security services, reliable messaging, transactions, AJAX and REST Support

@kanagu 2010-06-15 09:43:34

Web Services

  1. It Can be accessed only over HTTP
  2. It works in stateless environment

WCF

WCF is flexible because its services can be hosted in different types of applications. The following lists several common scenarios for hosting WCF services:

  • IIS
  • WAS
  • Self-hosting
  • Managed Windows Service

@John Saunders 2009-07-18 05:41:55

Here's a new, big, difference: Microsoft now considers ASMX web services to be "legacy" technology. See "XML Web Services Created Using ASP.NET and XML Web Service Clients".

@RichardOD 2009-09-18 09:40:44

+1 As you've mentioned this before in other posts and it is an important point.

@Simon_Weaver 2010-01-07 08:39:22

the header from this article : "This topic is specific to a legacy technology. XML Web services and XML Web service clients should now be created using Windows Communication Foundation (WCF)."

@Christian Payne 2009-06-21 01:26:36

I had the same problem.

I found the book Microsoft Windows Communication Foundation Step by Step to be really good.

If you just want to do the traditional webservice thing using WCF, then Chapter 1 of that book will show you exactly how to do that (write service, test, deploy, use service).

Its written for VS2005, but I'm using vs2008 and found it even easier.

There's a lot more to WCF, but that book is a good start.

@Ralph Willgoss 2010-04-20 23:44:23

+1 thanks for the link to the book

@user29439 2008-10-19 21:18:50

In addition to the above responses, WCF was created to replace .NET Remoting in .NET 3.0 and beyond. In addition to SOAP, REST, POX, etc. web services in various formats (e.g. XML and JSON), WCF also offers MSMQ and Named Pipes. ASMX, as mentioned above, provides only SOAP-based XML web services.

You would need to delve into .NET Remoting for other types of communication protocols. For additional information, you should check out Pro C# 2008 and the .NET 3.5 Framework. It's a great resource, and you can get the chapters from the previous books that cover .NET Remoting, and other replaced features.

@balexandre 2008-10-19 21:15:02

it is quite easy to know the differences.

ASP.NET Web Method is called ASMX [because of the file extension] (check 4GuysFromRolla about this, they have a good tutorial)

That technology makes you expose functions as a Web Service so you can connect it from everywhere and use it. But... you can't protect the data between server and client, you can send big files clear and know what happend, etc...

[Note] you can protect the access to the web service using certificates, but it is complicated but normally, in ASMX we use username / passsword.

in WCF, you are in the different world about Web Services,and this s the best technology in .NET to expose Services (can you see the difference... Services! not Web Services), WCF does not need IIS to run, it can run as a System Service on the server, using a console ambient (like command line), etc, so we say that WCF is a Service not Web Service. Remember ASMX need IIS to run.

with WCF you can use SSL to encrypt the communication (to do that in ASMX you need to use WSE - Web Services Enhancements), you can send big files and securely (to do that in ASMX you need to use MTOM - Message Transmission Optimization Mechanism).

you can set the transmission preferences just changing one line of code, the security is much higher, etc, etc :)

hope you get a better general overview with this, but there is much more.

bottom line: to expose Web Services that you do not need to protect, you can use ASMX, no problem at all, but if you need to protect the communication somehow, do it in WCF!

link: you can read here some performance comparative between the 2 services

@Jorge Villuendas Zapatero 2008-10-19 20:45:36

ASP.NET Web services was developed for building applications that send and receive messages by using the Simple Object Access Protocol (SOAP) over HTTP.

WCF is for enabling .NET Framework applications to exchange messages with other software entities. SOAP is used by default, but the messages can be in any format, and conveyed by using any transport protocol.

You can view ASP.NET web services as a subset of WCF services.

Here is a link comparing the two frameworks.

@Ralph Willgoss 2010-04-20 23:41:38

+1 thanks for link and the nice clear explanation

@smaclell 2008-10-19 20:38:49

They are two different frameworks for writing services. WCF is generally more flexible and provides configurable options for what protocols are used, how the service is hosted and a variety of security options. ASMX offers SOAP based services. Generally WCF is also more performant. In general ASMX is easier to use and generally has less of a learning curve.

Here is a MSDN forum discussion on the topic. Here are the getting started pages for ASMX and WCF.

@Vaibhav 2008-10-19 20:45:53

They are two different things all together. WCF is a more generic framework through which you can write one service type component and deploy it in many ways (even as an Asp.Net Web Service).

Here's a brief thread about this http://social.msdn.microsoft.com/Forums/en-US/wcf/thread/2d6a7ff2-f15c-4599-a389-a81cfffcc852/

Related Questions

Sponsored Content

15 Answered Questions

10 Answered Questions

[SOLVED] SOAP vs REST (differences)

40 Answered Questions

[SOLVED] How do I format a Microsoft JSON date?

25 Answered Questions

[SOLVED] ASP.NET Web Site or ASP.NET Web Application?

8 Answered Questions

[SOLVED] Difference between OData and REST web services

11 Answered Questions

[SOLVED] WCF vs ASP.NET Web API

6 Answered Questions

[SOLVED] REST / SOAP endpoints for a WCF service

  • 2008-10-09 10:11:30
  • Wessam Zeidan
  • 258649 View
  • 419 Score
  • 6 Answer
  • Tags:   wcf rest soap

12 Answered Questions

[SOLVED] REST API error return good practices

18 Answered Questions

[SOLVED] Best Practices for securing a REST API / web service

5 Answered Questions

[SOLVED] What are the differences between WCF and ASMX web services?

Sponsored Content