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.targetFramework
to4.5
, or - In your
appSettings
, setaspnet:UseTaskFriendlySynchronizationContext
totrue
.
More information is available here.