In the ConfigureOnPremisesContext an event handler is registered containing an async function which is invoked with .GetAwaiter().GetResult();
This can and will freeze your whole asp.net application due to the nature of how the continuation of that task is done in this context.
Wrapping it in a Task.Run fixes this issue and ensures any exception are still thrown in the current synchronisation context.
In the ConfigureOnPremisesContext an event handler is registered containing an async function which is invoked with .GetAwaiter().GetResult(); This can and will freeze your whole asp.net application due to the nature of how the continuation of that task is done in this context.
Wrapping it in a Task.Run fixes this issue and ensures any exception are still thrown in the current synchronisation context.