Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8941455
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 15, 20262026-06-15T11:18:21+00:00 2026-06-15T11:18:21+00:00

I have a controller with something like the following: public MyController : Controller {

  • 0

I have a controller with something like the following:

public MyController : Controller
{
    public ActionResult DoSomething()
    {
        CallSomeMethodWhichDoesAsyncOperations();
        return Json(new { success = successful }, JsonRequestBehavior.AllowGet);
    }
}

When calling my controller I get the following error:

An asynchronous operation cannot be started at this time. Asynchronous operations
may only be started within an asynchronous handler or module or during certain
events in the Page lifecycle. If this exception occurred while executing a Page,
ensure that the Page is marked <%@ Page Async="true" %>.

Now I dont have control over CallSomeMethodWhichDoesAsyncOperations and the method itself is not async but internally does some async fire and forget. What can I do to fix it? Have tried to change the controller to an AsyncController and/or making the method in the controller async.

Edit:

When I attempted to use an AsyncController I first tried, with the same result

public MyController : AsyncController
{
    public ActionResult DoSomething()
    {
        CallSomeMethodWhichDoesAsyncOperations();
        return Json(new { success = successful }, JsonRequestBehavior.AllowGet);
    }
}

And then

public MyController : AsyncController
{
    public async Task<ActionResult> DoSomething()
    {
        CallSomeMethodWhichDoesAsyncOperations();
        return Json(new { success = successful }, JsonRequestBehavior.AllowGet);
    }
}

Which did change the exception to the following “An asynchronous module or handler completed while an asynchronous operation was still pending.”

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-15T11:18:22+00:00Added an answer on June 15, 2026 at 11:18 am

    Now I dont have control over CallSomeMethodWhichDoesAsyncOperations and the method itself is not async but internally does some async fire and forget. What can I do to fix it?

    Contact the person who wrote it and make them fix it.

    Seriously, that’s the best option. There’s no good fix for this – only a hack.

    You can hack it to work like this:

    public MyController : Controller
    {
      public async Task<ActionResult> DoSomething()
      {
        await Task.Run(() => CallSomeMethodWhichDoesAsyncOperations());
        return Json(new { success = successful }, JsonRequestBehavior.AllowGet);
      }
    }
    

    This is not recommended. This solution pushes off work to a background thread, so when the async operations resume, they will not have an HttpContext, etc. This solution completes the request while there is still processing to be done. This solution will not behave correctly if the server is stopped/recycled at just the wrong time.

    There is only one proper solution: change CallSomeMethodWhichDoesAsyncOperations.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I would like to have the following signature of a MVC controller. public ActionResult
Have Controller: public class MyController : Controller { [HttpGet] public ActionResult MyAction(int iMode, string
I have the following action: public class HomeController : Controller { public ActionResult Index(int?
I have a controller something like this: Ext.define('DigitalPaper.controller.Documents', { extend: 'Ext.app.Controller', views: ['Documents'], stores:
In my Rails controller I have something like: def authenticate_user! if not current_user #
I have a controller method that is a little something like this: def suggestions
I have something like: <h:commandButton> <h:ajax event=click listener=#{controller.onLog} onchange=onLogProcess /> .... </h:commandButton> I send
I want to have a route that looks something like: www.abc.com/companyName/Controller/Action/Id However, all the
I have the following code wrapped by swig: int cluster::myController(controller*& _controller) { _controller =
In my route I have something like this: controller/action/{id} To my knowledge this means

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.