Open AnthonySjr opened 4 years ago
i had the same problem and it bugged the hell out of me, but i finally figured it out from reading some of the issues here. you are most likely having issues similar to #196 . If you initialize your Tracelistner you will most likely see the error as something similar to this:
Sender : dbo_Table_5c189f89-5ce7-4832-a18d-03cf38d579e7, Msg : Queue containing a message type not expected [http://schemas.microsoft.com/SQL/ServiceBroker/EndDialog].....
I handle this error by implementing the OnError event , stopping and starting the Dependency. Stop will basically delete everything and Start will create again.
TraceLevel = System.Diagnostics.TraceLevel.Verbose;
TraceListener = new System.Diagnostics.TextWriterTraceListener($"{tableName}.txt");
OnError += DbCache_OnError;
private void DbCache_OnError(object sender, TableDependency.SqlClient.Base.EventArgs.ErrorEventArgs e)
{
LogHelper.Logger.Error(e.Error, $"Error occurred for {e.Sender}");
Stop();
Start();
}
I should point out here that i actually extended the library so the behavior might be different in the main library. but at least you know what the issue is now.
hi @doaji now its happening to me, SQLTD suddently stopped working, Start() & Stop() methods are from sqldependancy?
void SqlTableDependency_OnError(object sender, ErrorEventArgs e) {
SqlDependency.Stop(ConnectionString());
SqlDependency.Start(ConnectionString());
}
? any help its appreciated, thnxs
Hello Cristian, SqlTableDependency with Web Service It is very good, it helped me a lot but there is a detail. At the moment I start my service it works correctly about 2 days to 3 days it works fine, but then it stops working until I restart it again the service would like to know how I can avoid that and keep it simple active or know the moment it stops working for call back to activate.
thank you