The SQL Server Service Broker for the current database is not enabled, and as a result query notifications are not supported.

时间:2021-09-09 11:57:16

当Insus.NET尝试解决此问题《When using SqlDependency without providing an options value, SqlDependency.Start() must be called prior to execution of a command added to the SqlDependency instance.http://www.cnblogs.com/insus/p/5622792.html 时,

又出现另外一个警示:
The SQL Server Service Broker for the current database is not enabled, and as a result query notifications are not supported.

解决方法是,Enable Service Broker on the database:
The SQL Server Service Broker for the current database is not enabled, and as a result query notifications are not supported.

ALTER DATABASE [DataBase Name] SET ENABLE_BROKER WITH ROLLBACK IMMEDIATE

Source Code