我为什么要选择 Windows 服务而不是 Web API 服务?

Why would I choose a Windows Service over a Web API service?

对我来说,Windows 服务既不方便又繁琐,足以质疑它们在所有非 "Watch this folder for a change, react to this change."

应用程序中的有效性

我明白这种过于简单化是无知的,为什么人们会选择 windows 网络服务 API。

每次您有一些未被 HTTP 请求激活的东西?

要获得提示,运行 services.msc 来自 WIN+R(运行 程序)。检查服务并尝试查看是否所有服务都可以托管在 IIS 中。

如果没有:好吧,这就是你的答案。

I do believe we can skate by the reboot issue with our centralized monitoring service, as well as the IIS "never go down" module. I've chosen to leave the service as a Windows Service while I automate his deployment, however I'm not completely convinced it's worth the inconvenience of install -> attach debugger -> make change -> start/stop -> attach debugger -> flail when debugger fails because service locks a file, etc

恕我直言,当您已经将相关内容内置到 windows(监控 = windows 事件日志)时,依赖监控服务和始终在线的模块要脆弱得多。

至于调试 windows 服务,它们在 Program.cs 中稍加改动就很容易调试。我在这里写过:http://blog.gauffin.org/2011/09/05/an-easier-way-to-debug-windows-services/