My application is running on MVC 5 . Recently I upgraded the Npgsql nuget package version and after that started getting below error in the application.
**Error :- ** HttpServerUtility.Execute blocked while waiting for an asynchronous operation to complete with partail view. Error executing child request for handler 'System.Web.Mvc.HttpHandlerUtil+ServerExecuteHttpHandlerAsyncWrapper'.
Below is the code samples used in the application.
Cshtml page :-
Html.RenderAction("GetData", "ControllerName")
Controller :- Action method is having async and await
public async Task<ActionResult> GetData()
{
var data = await _service.Data();
return View("Data", data );
}
This code was running fine but getting these exceptions after upgrading the Npgsql version.
I have tried making action method synchronous by removing the async and used .Result instead of await but execution is stuck on _service.Data().Result .
public ActionResult GetData()
{
var data = _service.Data().Result;
return View("Data", data );
}
ASP.NET (pre-Core) does not support asynchronous child actions. There is no workaround. To solve this, you'll need to either: