SqlDependency losing subscription after upgraded to .NET4.5


  • My service which uses SqlDependency to receive notification for table changes has been working fine on .NET4. However since I upgraded to .NET4.5, it starts to lose subscription over time, especially where there's a lot of queries from my service to SQL. I'm able to reproduce this and when I go back to .NET4, the problem wasn't there. 

    I have checked the timing in my OnChange() function and its takes < 5 seconds to execute and on the last notification which I received, I did re-create another SqlDependency instance to subcribe for further notification. 

    When the issue appears, I saw this error in my sql errorlog:

    2014-02-26 18:02:02.25 spid40s     The query notification dialog on conversation handle '{D5DFC6C1-4397-E311-9D97-005056854BBF}.' closed due to the following error: '<?xml version="1.0"?><Error xmlns=""><Code>-8470</Code><Description>Remote service has been dropped.</Description></Error>'.

    Is there any known issue with SqlDependency on .NET4.5 and SQL Server 2008 R2?

    Wednesday, February 26, 2014 10:27 AM

All replies

  • Hello,

    I am trying to involve someone more familiar with this topic for a further look at this issue. Sometime delay might be expected from the job transferring. Your patience is greatly appreciated. 

    Thank you for your understanding and support.

    If you have any feedback on our support, please click here.


    Elvis Long
    TechNet Community Support

    Friday, February 28, 2014 5:07 AM
  • Hi,

    Any updates on this issue?

    Saturday, March 15, 2014 9:18 AM
  • This issue occurs because, when you call the SqlDependency.Stop method, the method does not actually cancel the notification subscription. When SQL Server sends a new query notification to the application, SQL Server cannot find the remote service. Therefore, error messages are logged. 

    There is a fix for this in SQL 2005 and SQL 2008. Refer

    This doesn't talk about SQL 2008 R2. However you can try enabling the trace flag 4133 since this is the fix added in SQL 2005 and SQL 2008 R2. 

    If the issue persists even after enabling the trace flag, then it might need a dedicated troubleshooting. So in that case, please contact the support team to look into it. 

    Best Regards,

    Rashmi | SQL Developer Support | Microsoft Corporation

    Friday, March 21, 2014 10:22 PM