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

∥☆過路亽.° 提交于 2019-12-03 06:59:44

问题


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?


回答1:


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.




回答2:


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.




回答3:


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.




回答4:


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.




回答5:


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.




回答6:


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.




回答7:


A Web Service is a dll hosted by a web server and run as a web application and can be spun up upon request.

A windows service is an exe hosted by the operating system and runs continuously waiting on a request.




回答8:


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.



来源:https://stackoverflow.com/questions/1033570/what-are-the-differences-between-a-web-service-and-a-windows-service

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!