简体   繁体   中英

Can I host a Worker Service project in IIS?

In Visual Studio 2019, I can setup a new project of type "Worker Service", which sets up a console application for long running worker processes.

I can host these Worker Services in Docker or as Windows Service (with additional code), but my question is:

Can I host a Worker Service project in IIS?

As far as I know, it may difficult. If you check document about worker service, Microsoft doesn't suggest you do that because there is no any word about host worker service on IIS.

Actually, if any application can host or Microsoft suggest users host on IIS, you can see "IIS Express" in VS. However, you cannot see that when create a worker service application. 在此处输入图片说明

However, deveploer in this thread can achieve what you want. Just some strange issues happened.

After a couple more months of using this configuration, it becomes clear that it will sometimes behave in slightly curious ways - for example starting multiple instances of the same thread - and it can generally be a little quirky. It also isn't necessarily any easier to troubleshoot than a regular windows service, although it probably is easier to deploy.

As a conclusion, you can do that but it is not recommended. Especially once something goes wrong, it's hard to troubleshoot.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM