none
WCF-SQL Adapter Not Calling PolledDataAvailableStatement? RRS feed

  • General discussion

  • From regularly occurring warning messages in my event log, I suspected that my PollingStatement was being called with every PollingInterval, regardless of whether or not PolledDataAvailableStatement returned 0 in the result set. I ran a SQL trace to see what was going on and found my assumptions to be true.

    However, what's more strange is that the PolledDataAvailableStatement is never even called. I have checked, and double checked my SQL syntax. I've even changed the statement to something so simple, it couldn't fail --for example, "select cast(0 as int)."

    Everything in the documentation seems to indicate this functionality is available to XMLPolling (my InboundOperationType). What's going on?

    Wednesday, June 2, 2010 6:32 PM

All replies

  • Is your PollWhileDataAvailable statement set to true?
    Thursday, June 3, 2010 4:50 AM
  • Hi, kgarske

    We are changing the issue type to "General Discussion" because you have not followed up with the necessary information. If you have more time to look at the issue and provide more information, please feel free to change the issue type back to Question. If the issue is resolved, we will appreciate it if you can share the solution so that the answer can be found and used by other community members having similar questions.

    Thank you!


    This posting is provided "AS IS" with no warranties, and confers no rights. Microsoft Online Community Support
    Thursday, June 10, 2010 5:44 AM
    Moderator
  • Andrew, I am not able to reply to Manas' post due to an error with the Forum software (which I have reported to your customer service).

    My answer to his question is Yes.

    Friday, June 11, 2010 5:42 PM
  • When PollWhileDataAvailable is set to true, the PollDataAvailableStatement is not called as long as the adapter is able to fetch data (>0 rows fetched). This is nicely expained with flowcharts on this page http://msdn.microsoft.com/en-us/library/dd788416(BTS.10).aspx under the heading "Strongly-Typed Polling"

    Monday, June 14, 2010 8:10 AM
  • Manas,

    Thanks for the reply. I should have noted that the behavior I have described is occurring even as my PollingStatement fetches zero rows. As a simple example, I would expect the following:

    1. PollDataAvailableStatement returns count = 1
    2. PollingStatement returns 1 row
    3. PollingStatement returns 0 rows (immediately after)
    4. 10 seconds (polling interval)
    5. PollDataAvailableStatement returns count = 0
    6. 10 seconds (polling interval)
    7. etc. etc.

    Instead, what I am seeing is:

    1. PollingStatement returns 1 row
    2. PollingStatement returns 0 rows (immediately)
    3. 10 seconds (polling interval)
    4. PollingStatement returns 0 rows
    5. 10 seconds (polling interval)
    6. etc. etc.

    Note that I never see PollDataAvailableStatement fire in my SQL trace --ever. Also, I am using "XMLPolling", not "Strongly Typed Polling". Not sure if there is a difference.

    Just as supplemental information, I am receiving the following extremely helpful (sarcasm) warning in my event log every 10 seconds (again, my polling interval). I believe this is because my PollingStatement is being called with no results returned:

    The adapter "WCF-SQL" raised an error message. Details "System.InvalidOperationException: Invalid command sent to ExecuteXmlReader.  The command must return an Xml result.

       at Microsoft.ServiceModel.Channels.Common.Design.AdapterAsyncResult.End()

       at Microsoft.ServiceModel.Channels.Common.Channels.AdapterInputChannel.EndTryReceive(IAsyncResult result, Message& message)

       at System.ServiceModel.Dispatcher.InputChannelBinder.EndTryReceive(IAsyncResult result, RequestContext& requestContext)

       at System.ServiceModel.Dispatcher.ErrorHandlingReceiver.EndTryReceive(IAsyncResult result, RequestContext& requestContext)".

     


    Monday, June 14, 2010 5:20 PM
  • Have you set UseAmbientTransaction to false? Try setting it to true.
    Thursday, June 17, 2010 4:33 AM
  • I've recently learned that UseAmbientTransaction = true is in fact necessary in my case. The reason is that I have an update following my select in the PollingStatement to set rows as processed. It seems that composite operations like this are troublesome to the adapter and without the AmbientTransaction it thinks rows are being returned (even though I have set nocount on). Therefore, when combined with PollWhileDataFound = true, it just keeps running the PollingStatement over and over. This is probably why PollWhileDataFound is never called.
    Thursday, December 23, 2010 9:53 PM
  • Hi

    Is the issue resolved? I got the same annoying warning in event log.

    Thanks,

    Dennis

    Thursday, November 24, 2011 7:26 PM
  • Is there a solution for this issue?

    Do you think that CU :  http://support.microsoft.com/kb/2481676 will fix this issue?


    Thanks, SKGuru

    Monday, March 4, 2013 6:12 PM