数据库更改通知到Windows服务?

now*_*ed. 5 .net c# sql-server windows-services asp.net-web-api

WebAPI用来将一些数据推送到数据库.

在同一服务器中运行的Windows服务必须在数据插入时得到通知 WebAPI

我已经看到这个问题建议使用Service Broker或者SqlDependency问题似乎是在不久前提出来的.

我google了但找不到更简单的解决方案.我想做的就是when a new data is inserted to Database, a function in the the windows service should fire.

我们在WebAPI - Windows Services上下文中是否有任何替代方案或类似的解决方案?

use*_*r_0 0

有一种方法。我不太喜欢它,但你可以使用 CLR Integration。
您可以使用它来编写触发器:https://msdn.microsoft.com/en-us/library/ms131045.aspx

它可以联系外部资源设置正确的权限:https://msdn.microsoft.com/en-us/library/ms345101.aspx

然后你可以通过套接字调用你的服务,或者将其设为Web服务。但你需要 C# 编程技能。