I am using async/await pattern in .NET 4.5 to implement some service methods in WCF. Example service:
Contract:
[ServiceContract(Namespace = \"http:/
Update: As pointed out by in the comments below, this solution is not thread safe, so I guess the solutions discussed above is still the best way.
I get around with the problem by registering the HttpContext into my DI container (Application_BeginRequest) and resolve it whenever I need it.
Register:
this.UnityContainer.RegisterInstance(new HttpContextWrapper(HttpContext.Current));
Resolve:
var context = Dependencies.ResolveInstance();