From 372e597f349f20b2d317ea210d89893a65236ea8 Mon Sep 17 00:00:00 2001 From: Eric Green Date: Tue, 1 Aug 2017 12:56:39 -0500 Subject: [PATCH] Added Timeout to HttpClient to always be longer than the InvocationTimeoutMilliseconds. HttpClient defaults to 100 seconds. If InvocationTimeoutMilliseconds is greater than the default of the HttpClient, the task will fail with a Task was canceled exception. --- .../HostingModels/HttpNodeInstance.cs | 1 + 1 file changed, 1 insertion(+) diff --git a/src/Microsoft.AspNetCore.NodeServices/HostingModels/HttpNodeInstance.cs b/src/Microsoft.AspNetCore.NodeServices/HostingModels/HttpNodeInstance.cs index a87e3d3..69b12e4 100644 --- a/src/Microsoft.AspNetCore.NodeServices/HostingModels/HttpNodeInstance.cs +++ b/src/Microsoft.AspNetCore.NodeServices/HostingModels/HttpNodeInstance.cs @@ -50,6 +50,7 @@ namespace Microsoft.AspNetCore.NodeServices.HostingModels options.DebuggingPort) { _client = new HttpClient(); + _client.Timeout = TimeSpan.FromMilliseconds(options.InvocationTimeoutMilliseconds + 1000); } private static string MakeCommandLineOptions(int port)