3

its my first question on stackoverflow.

i have read a lot of articles that said developers should use WCF instead of web services, because it could be hosted on different hosting environment,etc...

but what i'm thinking of is that i can call web service form any project using HttpRequest. so why i have to use WCF.

Ben Robinson
  • 21,601
  • 5
  • 62
  • 79
  • you don't have to use WCF, if a SOAP web service will work just as well for you. you may have to retarget your framework to 2.0 though, since there is not a SOAP Webservices template in visual studio for .net 4. – Frank Thomas Mar 11 '13 at 17:42
  • WCF is Microsoft approach to implement SOA. With WCF you can use multiple binds to reach your server such as Net Tcp, MsMq, and others. – Thiago Custodio Mar 11 '13 at 17:43
  • 1
    You might be interested in Web API as an alternative: http://www.asp.net/web-api – Tim M. Mar 11 '13 at 17:49
  • @TimMedora Thats a good suggestion, forgot all about that in my answer. – Greg Mar 11 '13 at 17:59
  • @FrankThomas: why in the world would you suggest the OP revert to an old Framework version in order to use obsolete technology? Was that meant as a joke? – John Saunders Mar 13 '13 at 00:33
  • merely a statement of the technical realities. from the ops title, it is clear that they are not overly enthusiastic about the change. its called sub-text. learn to pick it up, before resorting to snark. – Frank Thomas Mar 13 '13 at 11:33

3 Answers3

2

With WCF, the out-of-the-box binding is BasicHttpBinding, which is just SOAP, the same as .asmx web services. As a client, you can still access it the exact same way you accessed .asmx services - either by generating a proxy from the WSDL, or normal HttpWebRequest or whatever you were using before.

The benefit is all the additional options you get with WCF, like security, the possibility for different bindings, standalone hosting, and a whole lot more. Plus it's the direction the .NET community has chosen, so if you want to stay relevant in a .NET service-based world, you'll need to learn it.

Joe Enos
  • 39,478
  • 11
  • 80
  • 136
1

There is a lot more to WCF than there is to an ASMX web service. If an ASMX web service suits your needs then it is fine to use one, however you might find that there are problems that are easier solved using WCF than and ASMX web service. There are also many things that you can do using WCF (remember its a framework not just a way of creating a web service) that you simply can't do using an ASMX web service.

Creating WCF services instead of ASMX web services even if they serve the same purpose may seem like added complexity for no added benefit but it is a good way to start to learn WCF.

Ben Robinson
  • 21,601
  • 5
  • 62
  • 79
0

You don't have to use Windows Communication Foundation. It is ultimately going to be your choice. Also the project may contribute to your needs.

However, the primary reason you would use Windows Communication Foundation would be the following reasons:

  • Provides a varying array of communication across several platfrms: HTTP, HTTPS, TCP, MSMQ, and Etc.
  • It provides additional Security.
  • It has a better means of Serialization and Deserialization.
  • It provides more code re useability.
  • Different forms of hosting.

Those are some of the keys, the most important was it's design to save developers time in web based communication. It also is a methodology to bring Service Oriented Architecture as well, for fully agile applications.

Another important note is to realize that Microsoft has limited support for standard web services; now that they've implemented WCF technology.

Hopefully that helps.

Greg
  • 11,302
  • 2
  • 48
  • 79