Please ensure you are writing an ASP.NET 4.5 application, and targeting 4.5. async and await have undefined behavior on ASP.NET unless you are running on 4.5 and are using the new “task-friendly” synchronization context.
In particular, this means you must either:
- Set
httpRuntime.targetFrameworkto4.5, or - In your
appSettings, setaspnet:UseTaskFriendlySynchronizationContexttotrue.
More information is available here.