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

  • Home
  • SEARCH
  • 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 7165159
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 28, 20262026-05-28T14:11:40+00:00 2026-05-28T14:11:40+00:00

Is it possible to wrap a call using the TPL Library in .Net? I

  • 0

Is it possible to wrap a call using the TPL Library in .Net?

I want to do something like this

Task t1 = Task.Factory.StartNew(() => { dynamic result = FacebookApp.Get("me/videos/uploaded", parameters); });

But I get an HttpContext error, I am assuming this is because the FacebooApp.Get method is using this internally.

How can I wrap calls to the FB API into tasks to run in parellel on the server?

I forgot to mention I am using the Facebook C# SDK hence FacebookApp.Get


EDITED

I have been watching some pluralsight videos on the TPL library and went with the pattern in the picture below. As you said there is the main thread coming in from the Create Controller itself, but I still needed to spawn 4 separate network tasks to do the network calls in parallel. I fix the HttpContext error by not having the function that was being called in 4th task to not rely on HttpContext at all.

The net result for me now is a more highly performance method call as promised with parallel programming.

  • 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-28T14:11:41+00:00Added an answer on May 28, 2026 at 2:11 pm

    If you call to a web service, and don’t want to block the request thread, it’s better to go with asynchronous pages (Web Forms) or asynchronous controllers (MVC). If you spin up a Task and need the value returned from the task, you will still be waiting for that operation to complete, which still blocks the request thread.

    Note that since ASP.NET is multi-threaded by default, you shouldn’t spin up multiple threads within a single web request.

    UPDATE:

    See this SO answer about multi-threading in web applications for more info.

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

Sidebar

Related Questions

How can I wrap a boto.storage_uri() call in python so I can handle possible
I want to call member function by passing it as template parameter, without using
I am designing a class library which will be used like this: Engine eng
Working with a PHP library class, and I'd like to wrap all of its
Is it possible to wrap some external API code AND a LINQ data context
Possible Duplicate: How do I calculate someone's age in C#? Maybe this could be
Possible Duplicate: .NET - What’s the best way to implement a catch all exceptions
Possible Duplicate: How do you send email from a Java app using Gmail? How
I have an unmanaged c++ library that outputs text to an std::ostream*. I call
is it possible to call a method of a plugin from within TypoScript? I

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.