Testing with a solution that uses the BAM API buffered event stream to write data to BAM via a receive pipeline. Testing with a file receive location and all was fine, then testing with a WCF-BasicHttp receive location and we immediately received a “Failed to Flush” exception when executing the bufferedEventStream.Flush() method.
Turns out the BizTalk Application Users group has access to the various stored procs and and BAM_Event_Writer role by default. See here for more detail, http://msdn.microsoft.com/en-us/library/aa577661.aspx.
The in-process host running the receive handler for the FILE adapter runs under an account that is a member of the BizTalk Applications User group, the Isolated host running the receive handler for the WS-BasicHTTP receive location is running under an account that is only a member of the BizTalk Isolated Users group. Adding the account that is running the IIS app pool to the BizTalk Application Users group fixed this issue.