After some more digging, I've tracked the problem down to the fact
that HttpContext.Current is null. Somehow, Context (in the
OnEndRequest method in my global application) is still non-null, but
if I attempt to remove the scope from there, it tells me that it is
not the currently registered scope. This works fine when compiling in
VS2010, but not under mono in Windows or Linux. As I'm not an expert
in
ASP.NET and Mono, I'm at a standstill with async methods until I
can figure this out.
Perhaps I could ask everyone a different question: I can merely check
to see if HttpContext.Current is null and then skip disposing of the
scope if it is. Will this leave open connections to the database or
have performance or other implications if I don't dispose of the
correct scope?
Thanks for your help,
Brian