views:

1081

answers:

4

I have to fetch some data from a .NET application using another .NET application. I am wondering which are the pros and cons of each approach. In my case both solutions will work, but, as my service consumes much memory, I fear that IIS could multiply unnecessarly the instances increasing the memory load. Should I provide this service as an ASP.NET Webservice or a Windows Service?

+2  A: 

Use a pure WCF service if you're only going to need it internally and on the .Net platform.

Webservices belong to the past for this kind of jobs. And with WCF you can get support for things that SOAP doesn't, such as Generic lists etc.

Gerrie Schenck
I like your answer, but I don't understand why "if you're only going to need it internally and on the .Net platform". Doesn't WCF Services answers to TCP requests from any platform?
Jader Dias
Yes you can expose a WCF service as a webservice, it is possible.What I really meant was: if you don't have to bother about these things: go for WCF :)For example if your clients are .Net 1.1 or another platform...
Gerrie Schenck
+3  A: 

Unless it is a relatively simple service that will only ever be consumed by .NET applications i would go with WCF, it may take a bit more time to learn but the shear flexibility and advantages it provide outweight the cost of time to learn IMHO.

Pro:

  • Flexibility to expose it in a different forms:
    • various hosting options (windows service, IIS, Windows Client, WAS...) &
    • various protocol options (basichttp, wshttp, nettcp...)
  • Interoperability with other languages (java etc..) if using the right bindings (eg. wshttp)
  • Instancing: If you are worried about instancing you can configure it as you wish (Single(ton), PerCall, PerSession...).

Cons:

  • Slightly steeper learning curve than standard web services
  • Slightly more involved in configuration than a simple web service (this is inherently due to the flexibility provided in the configuration options)

There are a whole bunch of related questions worth reading for some other points:

To go with traditional webservice or use WCF in VS2008/C#

WCF - advantages and disadvantages

.NET Remoting vs. Web Services vs. Windows Communication Foundation (WCF)

Is WCF platform independent?

Edit: Forgot to mention ASP.NET webservices:

Pro:

  • Quicker to learn
  • Quicker to implement
  • Potentially simpler to setup and deploy

Con:

  • Less configurable
  • Not as interoperable
mundeep
+5  A: 

Yes, definitely go with WCF. If you have the option to create a new webservice, there's really no point to use ASMX anymore (unless you're stuck on .NET 1.x/2.x).

And WCF is ALSO the better choice if you need to support Interop with non-.NET clients like Java or PHP or whatever else you might need to support.

It supports the WS-* webservice specifications (ASMX webservices don't) and has many more ways to tweak its communication with clients. It's more robust, it has way more support for security settings - it's just plain better all around!

Use WCF - you won't regret it.

Marc

marc_s
+2  A: 

The answer from marc_s is the correct one. I'll just add a clarification: WCF is web services - plus more. WCF is the current platform for web service development in .NET. A WCF service may be hosted in IIS or in an arbitrary .NET application (a Windows Service, for instance). It may use industry-standard protocols like SOAP and the WS-* protocols, or it may use binary formatting over TCP/IP, or a host of other options.

There is no reason to use ASMX web services unless you're stuck in the past (at .NET 2.0 or below). There is almost no reason at all to ever use WSE again, as it is obsolete.

WCF is the answer to almost all web service and many other communications questions.

John Saunders