I am working on query notification. I have created Queue, Service and Route in my Database. I am accessing my Database on Network by IP Address, so i created a Route in Sql Server like this..
ALTER ROUTE [NotificationMessagesRoute]
WITH SERVICE_NAME = N'MyNotificationService' ,
ADDRESS = N'TCP://myIPAddress:PortNo' --
on FrontEnd it have used SqlDependency like this..
SqlDependency dependency = new SqlDependency(command), "Service=MyNotificationService;local database=Test", int.MaxValue);
Its working Perfectly, if i am using Local Connection String and also Route in Sql Server as Local, but if i access DB on my organizations local Network, it do not show me notification on new Insertion.
I have also used SqlDependency object as below, but it gives me below Error.
SqlDependency dependency = new SqlDependency(command);
Error : When using SqlDependency without Providing an options value, SqlDependency.Start() must be called prior to execution of a command added to the SqlDependency instance.
Plz Help...
Add start the dependency in Startup class
System.Data.SqlClient.SqlDependency.Start(ConnectionString);