Even though this is an older post, I thought the solution to my problem could help others looking for an answer to this problem.
Using the above suggestion from Led Machine - to see the stack trace, I found the following top lines.
Exception Info: System.NullReferenceException at System.Web.ThreadContext.AssociateWithCurrentThread(Boolean) at System.Web.HttpApplication.OnThreadEnterPrivate(Boolean) at System.Web.LegacyAspNetSynchronizationContext.CallCallbackPossiblyUnderLock(System.Threading.SendOrPostCallback, System.Object)
Googling this stack trace, sent me to this page:
https://techcommunity.microsoft.com/t5/iis-support-blog/crash-at-system-web-legacyaspnetsynchronizationcontext/ba-p/1536553
Apparently, the problem was related to my application being configured to use Legacy ASP.NET Synchronization Context, and in certain parts of the code, I was using some new features, such as Tasks. The old (Legacy) context cannot handle some asynchronous calls properly and this leads to the crash as observed in the above.
The fix is to insert the following line in your web.config:
<appSettings>
<add key="aspnet:UseTaskFriendlySynchronizationContext" value="true" />
</appSettings>