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

Asked

Viewed 1,244 times

1

My company often creates Windows services to publish services Web.

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

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

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

1 answer

1


An answer to that question may be quite long, but I will try to summarize a few points:

  • Management "Web":
    If you create a Web service, be a Webservice, WCF, or an application that answers calls HTTP, as a Web Api, it makes sense to publish on 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 can manage 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 in ISS.

  • Memory management: Memory management of a host application on IIS is much more transparent than a Windows or other host, such as a Windows Application (just as an example here, a usual test only option). You can have an Application Pool with very specific settings for a particular application. Also, you can manage things like recycling the Application Pool by memory limit and CPU, which is harder to control on 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, that can recycle or terminate your service.

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

  • Protocols
    A host service like Windows Service can serve several protocols, HTTP, net.tcp, net.pipe and net.msmq. The IIS also, but only from version 7.0. If you have a previous version server, you can only use HTTP.

I tried to compare some points to help decide which is the best solution for each scenario.

There is a very interesting document from the MSDN in English that you should take a look at, especially in the comparison framework between the various technologies and scenarios: Hosting Services

  • Thank you for the excellent answer. I gave to understand well because nomalmente the choice of hosting is in a server Web and what times should I choose Windows service. My company has 20 years of existence and has several services in TCP should be the reason why they have so many services hosted as services of the Windows.

  • 1

    Interestingly . Net Core goes another way and a half that encourages use stand alone: http://answall.com/q/40671/101

  • I don’t really know . Net Core yet, but I saw that it has a very different memory management, it may have some relationship. As he intends to run on all platforms, I think they want to "take off" him from IIS, I think MS wants him to run on a Node.js architecture, maybe it also encourages using a self-host for services, quite interesting this @bigown

  • @Ricardopunctual as far as I know it does not have a different memory management, Pleo less not compared to the traditional . Net. But really the idea is to give freedom to do whatever you want, wherever you want, however you want.

Browser other questions tagged

You are not signed in. Login or sign up in order to post.