I have a ASP.Net Web Forms application that calls a WCF service hosted on IIS via a button click event inside a Ajax Update panel. When I click the button I call a WCF Async process that can take over 1 minute to return. I've noticed when the task is running and I open another tab in my browser the web page freezes/clocks until the long running task returns. I assume that the first task is locking the UI thread causing anyone else to use the web page to have to wait.

How can I run a task, update the UI with the results and not block the UI for other Tabs/Users?

Here is a snipit of code:

 protected void btnsearch_ServerClick(object sender, EventArgs e)
    {

        Page.RegisterAsyncTask(new PageAsyncTask(async () =>
        {
            DataSet ds;
            ds = await data.GetReportAsync();

            grdsummary.DataSource = ds.Tables[0];
            grdsummary.DataBind();
        }));

    }

I did try adding .ConfigureAwait(false) to the Async call but that didn't do anything.

Related posts

Recent Viewed