You have to set HttpContext.Current.User
as well. See this answer and this blog post for more info.
Update: Also ensure you are running on .NET 4.5 and have UserTaskFriendlySynchronizationContext
set to true
.
More Related Contents:
- Best practice to call ConfigureAwait for all server-side code
- Why is HttpContext.Current null after await?
- Effectively use async/await with ASP.NET Web API
- How do you implement an async action delegate method?
- Why is an “await Task.Yield()” required for Thread.CurrentPrincipal to flow correctly?
- Running multiple async tasks and waiting for them all to complete
- Specifying a custom DateTime format when serializing with Json.Net
- Entity Framework async operation takes ten times as long to complete
- Regarding usage of Task.Start() , Task.Run() and Task.Factory.StartNew()
- Web API Put Request generates an Http 405 Method Not Allowed error
- Understanding async / await in C#
- Task sequencing and re-entracy
- How to update a claim in ASP.NET Identity?
- HTTP 404 Page Not Found in Web Api hosted in IIS 7.5
- catch all unhandled exceptions in ASP.NET Web Api
- Suppress properties with null value on ASP.NET Web API
- Is async/await suitable for methods that are both IO and CPU bound?
- Task.Yield – real usages?
- What thread runs the code after the `await` keyword?
- Process files concurrently and asynchronously
- How to return a file using Web API?
- Why is this web api controller not concurrent?
- The lack of non-capturing Task.Yield forces me to use Task.Run, why follow that?
- Web API in MVC solution in separate project
- Visual Studio 2012 Web API project won’t run – can’t find Newtonsoft.Json
- FromBody not binding string parameter
- Unhandled Exception Global Handler for OWIN / Katana?
- RunAsync – How do I await the completion of work on the UI thread?
- Timeout pattern on task-based asynchronous method in C#
- Is there a way in Json.NET serialization to distinguish between “null because not present” and “null because null”?