What are the advantages and disadvantages of publishing a Web service on a server or as a Windows service?

1

My company usually creates Windows services to publish services Web .

This means that the service is not hosted on any server (such as IIS). One obvious drawback I see right away is that the service is dependent on the operating system.

Previously, I had only created Web services hosted on a server, more specifically in IIS.

What are the advantages and disadvantages of publishing a Web service on a server or as a Windows service?

    
asked by anonymous 21.10.2016 / 11:17

1 answer

1

An answer to this question may be very long, but I'll try to summarize some points:

  • "Web" Management :
    If you create a Web service, either a Webservice, WCF , or an application that responds HTTP calls, such as an Api Web, it makes sense to publish to a Web server. A Web server, such as IIS , has a whole infrastructure to handle calls, HTTP protocol support (this includes caching, compression, security, ssl, etc), and managing a Web Farm if you want to scale your application. These things can also be done and implemented in a Windows Service, but not as practical as ISS .

  • Memory Management : Memory management of a hosted application in IIS is much more transparent than a Windows service or other hostage, such as a Windows Application (just as an example here, a usual testing option only). You can have an Application Pool with very specific settings that are in use for a particular application. In addition, you can manage things like recycle the Application Pool by limiting memory and CPU, which is harder to control in a service. Despite this, Windows Service remains always active while the service is running. In a critical service, this can be an advantage, unlike IIS , which can recycle or shut down your service.

  • With the app is enabled
    Although IIS , from version 7.5 and version 7 with (discontinued) AppFabric can automatically activate a WCF service, if your service is hosted as a Windows Service, this takes advantage. A Windows service can be activated as soon as Windows starts, that means it does not need to receive a request to be active, unlike something hosted in IIS .

  • Protocols
    A hosted service such as Windows Service can serve several protocols, HTTP, net.tcp, net.pipe and net.msmq. IIS also, but only as of version 7.0. If you have a previous version server, you can only use HTTP .

I tried to compare a few points to help decide the best solution for each scenario.

There is a very interesting MSDN document in English that you should take a look at, especially in the context of comparing different technologies and scenarios: Hosting Services

    
21.10.2016 / 12:05