I'm debugging an ASP.NET MVC 2 application running on .NET 4.0 (Windows 7), currently inside of Cassini, the Visual Studio Debugging Web Server.
All was running well, when I suddenly was having exceptions in my Application.EndRequest handler. After investigating into this issue, I found the reason was that Cassini was calling EndRequest on a different thread than BeginRequest (then, a ThreadStatic variable which was set in BeginRequest and used in the EndRequest handler was null, since on this thread, BeginRequest was never called).
What could be the reason for Cassini to execute BeginRequest and EndRequest on different threads?
I know the reason could be an 'Async' Page directive (see Do ASP.NET Requests always BeginRequest and EndRequest on the same thread? , but I have no 'Async' attribute in my Page directives).
There must be another cause.
Thank you!