I’ve been having a problem with messages not appearing in a WCF-SQL receive location of late. The receive location polls for new data every 30 seconds using the polledDataAvailableStatement and then when it finds some rows to process, the pollingStatement extracts those rows and then returns them to BizTalk using a very simple Stored Procedure. This mostly works fine but mysteriously around 25% of the time the rows were set to processed but no message appeared in the BizTalk message box and the items were lost forever. There were no suspended or failed messages. No messages in the Event Log. Absolutely nothing. Very mysterious.
The solution is I think that whenever you have a polling statement that does anything other than a select statement which mine is as it updates the affected rows to PROCESSED = true, you have to set useAmbientTransaction to true. We had originally disabled this because we thought it might have been related to table locking behaviour we had experienced in our development environments.
This msdn article seems to support the solution.
Not performing operations in a transactional context is advisable only for operations that do not make changes to the database. For operations that update data in the database, we recommend setting the binding property to true; otherwise you might either experience message loss or duplicate messages, depending on whether you are performing inbound or outbound operations.