1

Topic: SqlDependency changes in basis are not caught

I use in signalR public class ExampleHub: Hub, ITransientDependency {public override Task OnConnected () {Storage. ConnStr = WebConfigurationManager.ConnectionStrings ["Default"].ConnectionString; SqlDependency. Start (Storage. ConnStr); Storage. Connection = new SqlConnection (Storage. ConnStr); Storage. Connection. Open (); Storage. Command = new SqlCommand ("SELECT [State] FROM [Test]. [dbo]. [State]", Storage. Connection); Storage. Dependency = new SqlDependency (Storage. Command); Storage. Dependency. OnChange + = Dependency_OnChange; Storage. Command. ExecuteReader ();....... private void Dependency_OnChange (object sender, SqlNotificationEventArgs e) {}...... public static class Storage {public static bool IsEnabled; public static SqlConnection Connection; public static SqlCommand Command; public static SqlDependency Dependency; public static string ConnStr;} Dependency_OnChange 1 time is caused right after ExecuteReader and only, during changes in basis happens nothing

2

Re: SqlDependency changes in basis are not caught

Hello, - rsdn - you wrote: R> Dependency_OnChange 1 time is caused right after ExecuteReader and only, during changes in basis happens nothing http://stackoverflow.com/questions/3962 … nsistently http://stackoverflow.com/questions/3161 … th-signalr https://www.codeproject.com/articles/88 … d-sql-depe http://techbrij.com/database-change-not … ependency?

3

Re: SqlDependency changes in basis are not caught

Hello, - rsdn - you wrote: R> Dependency_OnChange 1 time is caused right after ExecuteReader and only, during changes in basis happens Try to make nothing the test without usage SignalR - simply to check up that itself SqlDependency Expression for tracing works looks, like is correct. Therefore try to look in SQL Server broad gulls - whether there are no there errors. I, for example, had not so long ago a same problem - notification messages about changes did not come. In broad gulls message An exception occurred while enqueueing a message in the target queue was found out. Error: 15404, State: 19. Could not obtain information about Windows NT group/user ' DOMAIN\Mihail_Romanov ', error code 0x54b. It appeared that I permanently work with SQL from under the security account, and the basis forms from my name (i.e. The owner of basis puts my domain security account - it  on dbo), and the owner of basis is necessary for any internal  with event queue. The problem dared change dbo on sa: sp_changedbowner ' sa ' Can and at you something something like that.

4

Re: SqlDependency changes in basis are not caught

Hello, Michael Romanov, you wrote: > Hello, - rsdn - you wrote: R>> Dependency_OnChange 1 time is caused right after ExecuteReader and only, during changes in basis happens nothing > Try to make the test without usage SignalR - simply to check up that itself SqlDependency Expression for tracing works > looks, like is correct. > Therefore try to look in SQL Server broad gulls - whether there are no there errors. > I, for example, had not so long ago a same problem - notification messages about changes did not come. > In broad gulls message > An exception occurred while enqueueing a message in the target queue was found out. Error: 15404, State: 19. Could not obtain information about Windows NT group/user ' DOMAIN\Mihail_Romanov ', error code 0x54b. > It appeared that I permanently work with SQL from under the security account, and the basis forms from my name (i.e. The owner of basis puts my domain security account - it  on dbo), and the owner of basis is necessary for any internal  with event queue. > the Problem dared change dbo on sa: > sp_changedbowner ' sa ' > Can and at you something something like that. Was Service Broker needs to access the master key in the database ' Test '. Error code:32. The master key has to exist and the service master key encryption is required. Made so http://www.sqlcoffee.com/Troubleshooting109.htm the error in broad gulls disappeared, but all on former by the way yes - I try without SignalR in WinForms on pushing the button

5

Re: SqlDependency changes in basis are not caught

Hello, - rsdn - you wrote: R> I use in signalR R> R> public class ExampleHub: Hub, ITransientDependency R> {R> public override Task OnConnected () R> {R> Storage. ConnStr = WebConfigurationManager.ConnectionStrings ["Default"].ConnectionString; R> SqlDependency. Start (Storage. ConnStr); R> Storage. Connection = new SqlConnection (Storage. ConnStr); R> Storage. Connection. Open (); R> Storage. Command = new SqlCommand ("SELECT [State] FROM [Test]. [dbo]. [State]", Storage. Connection); R> Storage. Dependency = new SqlDependency (Storage. Command); R> Storage. Dependency. OnChange + = Dependency_OnChange; R> Storage. Command. ExecuteReader (); R>....... R> private void Dependency_OnChange (object sender, SqlNotificationEventArgs e) R> {R>} R>...... R> public static class Storage R> {R> public static bool IsEnabled; R> public static SqlConnection Connection; R> public static SqlCommand Command; R> public static SqlDependency Dependency; R> public static string ConnStr; R>} R> R> Dependency_OnChange 1 time is caused right after ExecuteReader and only, during changes in basis happens it was necessary to delete nothing a basis title [Test].