Enable Service Broker

Logging here for future reference.  I’m writing some caching code and am using the the System.Data.SQLClient.SQLDependency feature of the .NET framework to send a change notification event to my web services when the underlying data changes.

If when enabling Service Broker on SQL Server the script hangs be sure to enable single user mode and then after enabling service broker set back to multi user mode.  See the below script.

USE master;

GO

ALTER DATABASE MyDatabaseName SET RESTRICTED_USER WITH ROLLBACK IMMEDIATE;

GO

ALTER DATABASE MyDatabaseName SET ENABLE_BROKER ;

GO

ALTER DATABASE MyDatabaseName SET MULTI_USER WITH ROLLBACK IMMEDIATE;

GO

Advertisements
This entry was posted in SQL Server. Bookmark the permalink.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s