views:

560

answers:

8

What are the differences between a web service and a Windows service?

My experience has mostly been with Windows services, and I have never created a web service.

Do web services behave similarly to Windows services?
Can they have scheduling, run at certain times, etc.?
When you would use a web service in place of a Windows service, and vice versa?

+3  A: 

You are asking us to compare apples and oranges. I am posting definitions as well as links to further reading for you so you can see why these two things are exclusive and cannot be compared like you are trying to do.

Web service:

Web services are frequently just Internet application programming interfaces (API) that can be accessed over a network, such as the Internet, and executed on a remote system hosting the requested services

Windows service:

A Windows service is a long-running executable that performs specific functions and which is designed not to require user intervention.

Geoffrey Chetwood
+1  A: 

A Web Service is to a Windows Service as a Web Application is to a Windows Application.

A Windows Service runs as a local application, while a web service is typically accessed remotely using a stateless protocol. Communicating with a Windows Service uses local machine protocols, while a web service uses XML.

This wikipedia article has a pretty good description of Web Services.

Robert Harvey
+2  A: 

Webservices are simply a way of exposing services for consumption. They are about interaction between components.

A windows service is an executable that runs for a long time on a machine to perform some task.

You wouldn't use one in place of the other - they perform two entirely different functions.

For (a simple) example (to highlight the difference), if you wanted a method to pass control messages to your service, you could expose a webservice as the protocol through which third parties would communicate with your service.

Nader Shirazie
+1  A: 

A web service is software system used for machine to machine communication over a network.

Here's the wiki for Web Service.

A windows service, in contract, is a service that runs on an local machine.

Here's the wiki for Windows Service.

They are independent technologies, one would not replace the other.

Joseph
+18  A: 

They're about as different as two things can be.

A Windows service is an application that runs without a user being logged into the system, usually to process some data on the machine that needs no user intervention to work with.

A Web service is a website that, when contacted, returns XML (typically) in one of several standard formats for the service consumer to process.

One can't be substituted for the other. They are fundamentally different.

Welbog
+1, and JSON is a popular second option for a response format
altCognito
+2  A: 

A web service is an HTTP interface to a system. For example: the Twitter API or the Google Maps API are REST web services.

A Windows Service is a background process that runs without user interaction.

The two are not related.

John Cromartie
A: 

web service was mostly used in application integration between systems.

windows service was mostly used in background tasks, scheduled tasks.

A windows service program can call web service methods. web service program cannot call window service methods.

dev2709
A web service program can call window service methods.
tuinstoel
A: 

I don't think there is a very large difference, a web service runs in IIS or Apache, a windows service doesn't. You can call windows service methods by using remoting and you can create windows service with WCF. The methods of a windows service can return xml or json too.

IIS 6 doesn't support all the WCF possibilities so we have build WCF windows services (this is called self hosting).

Both a web service and a windows service are apps that run in the background. You can use WCF to build both kind of services.

tuinstoel
You don't build a windows service with WCF, but you can host a WCF service in a windows service. :)
markt