I want to get notification for a new record inserted into the database with this code:
var perm = new SqlClientPermission(System.Security.Permissions.PermissionState.Unrestricted);
perm.Demand();
SqlDependency.Stop(connectionString);
SqlDependency.Start(connectionString);
// I got an exception here when running the application “Windows 2008 Ent R2 SP1 64Bit”
Error of starting database Watcher: Cannot find the user ‘owner’,
because it does not exist or you do not have permission.Cannot find the queue
‘SqlQueryNotificationService-f41563c5-3c26-4469-8447-3ee41c801a55’,
because it does not exist or you do not have permission.Invalid object name
‘SqlQueryNotificationService-f41563c5-3c26-4469-8447-3ee41c801a55’.
I already have done this for the database and the user:
ALTER DATABASE [dbName] SET ENABLE_BROKER
use [dbName] GRANT SUBSCRIBE QUERY NOTIFICATIONS TO [dbUser]
So where could be the cause?
Thanks in advance.
Take a look at MSDN there are some restriction to the connection you use