Web.config setup to target 4.5 for correct async behavior

suggest change

The web.config system.web httpRuntime must target 4.5 to ensure the thread will reenter the request context before resuming your async method.

<httpRuntime targetFramework="4.5" />

Async and await on ASP.NET prior to 4.5 do not resume on the request context reliably. Async / await will resume on an arbitrary thread that may not have the request context. Applications under load will randomly fail with null reference exceptions accessing the HttpContext after the await. See this discussion of HttpContext.Current.

Feedback about page:

Feedback:
Optional: your email if you want me to get back to you:



Table Of Contents