Created
May 13, 2015 09:16
-
-
Save WilbertOnGithub/b746c7297ca8237e3b3f to your computer and use it in GitHub Desktop.
QueueBackgroundWorkItem example
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public class ValuesController1 : ApiController | |
{ | |
// POST api/<controller> | |
public void Post([FromBody]string value) | |
{ | |
HostingEnvironment.QueueBackgroundWorkItem(ct => StartBackgroundTask()); | |
} | |
private async Task StartBackgroundTask() | |
{ | |
/// Do your background work here. | |
HttpClient client = new HttpClient(); | |
HttpResponseMessage response = await client.GetAsync("http://www.google.com"); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
thank you, for the code...very helpful