title: c# Long Polling with SQL dependency with IIS Inconsistent
body: <p>The requirement from the customer was to be able to see refreshed data on the screen whenever there is any kind of change in a particular table in the database. </p>
  
  <p>We have a Job table in the DB whose contents are displayed in a GridView in the browser. The requirement is to refresh the grid data whenever any update, delete or insert happens in the Jobs table.</p>
  
  <p>We have used SQL dependency &amp; Long polling techniques to implement this. SQL dependency will notify asp.net of any change in the DB and long polling will keep the gridview updated asynchronously. </p>
  
  <p>We deployed this in IIS 7.0 and have noticed inconsistent behaviour i.e. the gridview gets refreshed most of the time, say 90-95% but there are times when the refresh doesnt take place though data in the DB table has changed. </p>
  
  <p>Has anyone faced this issue? Is there any specific configuration required in IIS for this? I did read in few places that IIS doesnt scale for comet programming. The above scenario happens in an testing environment with only one user. Any help would be greatly appreciated. Thanks in advance.</p>
  
  <p><strong>Edit:</strong> The issue seem to occur in ASP.Net development server as well and not isolated to IIS. After logging messages,we found that SQLDependency is what the breaks as the OnChange event is not triggered consistently.  </p>
  
  <p><strong>Edit 2:</strong> When i run the query <code>select * from sys.dm_qn_subscriptions</code> i get several rows for the same notification subscription i.e duplicate subscriptions. Only the id column is different. Could this be a reason? If yes why do i get duplicate subscription rows? How can I kill a subscription from ASP.NET?</p>