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 7128099
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 28, 20262026-05-28T11:06:12+00:00 2026-05-28T11:06:12+00:00

I have a web service that can be broken down into two main sections:

  • 0

I have a web service that can be broken down into two main sections:

[WebMethod]
MyServiceCall()
{
  //Do stuff the client cares about

  //Do stuff I care about
}

What I’d like to do is run that 2nd part on another thread, so that the client isn’t waiting on it: once the user’s logic has completed, send them their information immediately, but continue processing the stuff I care about (logging, etc).

From a web service, what is the recommended way of running that 2nd piece asynchronously, to get the user back their information as quickly as possible? BackgroundWorker? QueueUserWorkItem?

  • 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-05-28T11:06:13+00:00Added an answer on May 28, 2026 at 11:06 am

    You may want to look into Tasks which are new to .NET 4.0.

    It lets you kick off an asynchronous operation, but also gives you an easy way to see if it’s done or not later.

    var task = Task.Factory.StartNew(() => DoSomeWork());
    

    It’ll kick off DoSomeWork() and continue without waiting so you can continue doing your other processing. When you get to the point where you don’t want to process anymore until your asynchronous task has finished, you can call:

    task.Wait();
    

    Which will wait there until the task has completed. If you want to get a result back from the task, you can do this:

    var task = Task.Factory.StartNew(() =>
    {
        Thread.Sleep(3000);
        return "dummy value";
    });
    Console.WriteLine(task.Result);
    

    A call to task.Result blocks until the result is available.

    Here’s a tutorial that covers Tasks in greater detail: http://www.codethinked.com/net-40-and-systemthreadingtasks

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

Sidebar

Related Questions

I have a web service that I can only hit if I'm logged into
I have an ASP.NET web service that I can access via a windows program
I hope you can help me. I have a web service that needs to
I have web service written that generates some data...can I call the web service
Suppose I have WCF web service that that can retrieve collection of <Person> objects.
In VS2008, when I have a web service and a client of that web
I have to create a Web Service that can service around 100,000 clients. I
I have a requirement to implement a web-service that can issue files to the
I have a web service that provides queries functionality using hibernate. A query can
I have a web-service that I will be deploying to dev, staging and production.

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.