IIS vs Windows Service?

I have a C # application that I need to always run. I originally planned to make this a Windows service, but now I have a requirement to make the application the host of the web admin console.

I have not played with IIS for several years, so my question is this:

What would you recommend to me?

I was thinking of creating a Windows service and embedding a web server like Cassini, but so far I am not very happy with the open source web servers I was looking at.

Can IIS handle this? Do people use it for this type of scenario, and if so, how?

+4
source share
4 answers

This seems to work for two separate projects.

One of them is the original Windows service. Windows services are good for what you do.

The second is a web project that will be used to administer the Windows service. This is the part that works in IIS.

+7
source

It depends on what you mean by constant running. An ASP.NET web application deployed in IIS could very well be offloaded by a web server if there are no requests for a specific amount of time killing all background threads. Therefore, if you need a constantly running background thread, it is better suited to use the Windows service. As for the web administrator, here you do not have much choice: ASP.NET in IIS. To do something useful, these two applications should be able to find a common language for conversation. Thus, you can use the database to store the results that both applications can use.

+2
source

IIS will launch your application on first request, not when the server boots. Thus, you still need to start the service so that your application always works.

You can use IIS as a web server for your part of the web administrator and associate your ASP.net application with your service using the configuration database (simple) or web services (a little more complex).

+2
source

Windows and web services are two completely different creatures. The web service will disclose external methods that you can implement against the application, while the Windows service is an entity within itself. If you plan to use this service for a time interval to complete the operation, then the Windows service will be the right way. If you are using a web service, you will need to call the method that you want to run from the secondary application.

If you need a queue of commands against your Windows service, you can always create a database accessible both on your website and on your Windows service. This way you can send commands and request data between them. Placing a web service as an intermediate between them can be excessive.

+1
source

Source: https://habr.com/ru/post/1336831/


All Articles