Created
March 19, 2019 21:37
-
-
Save shibayan/8be1e4b848bdebcc4fa13a2ca01ac7d3 to your computer and use it in GitHub Desktop.
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
| using System; | |
| using System.Threading; | |
| using System.Threading.Tasks; | |
| using Microsoft.AspNetCore.Mvc; | |
| using Microsoft.Azure.WebJobs; | |
| using Microsoft.Azure.WebJobs.Extensions.Http; | |
| using Microsoft.AspNetCore.Http; | |
| using Microsoft.Extensions.Logging; | |
| namespace FunctionApp15 | |
| { | |
| public static class Function2 | |
| { | |
| [FunctionName("Function2")] | |
| public static async Task<IActionResult> Run( | |
| [HttpTrigger(AuthorizationLevel.Function, "get", "post", Route = null)] HttpRequest req, | |
| CancellationToken cancellationToken, | |
| ILogger log) | |
| { | |
| log.LogInformation("C# HTTP trigger function processing a request."); | |
| log.LogInformation($"CancellationToken is {cancellationToken.CanBeCanceled}"); | |
| try | |
| { | |
| await Task.Delay(TimeSpan.FromSeconds(60), cancellationToken); | |
| } | |
| catch (OperationCanceledException) | |
| { | |
| log.LogError("Cancelled"); | |
| } | |
| log.LogInformation("C# HTTP trigger function processed a request."); | |
| return new OkResult(); | |
| } | |
| } | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment