From 4a01fa770af1e36257fa1c126968c8ec72913b7d 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 a87e3d33..69b12e47 100644 --- a/src/Microsoft.AspNetCore.NodeServices/HostingModels/HttpNodeInstance.cs +++ b/src/Microsoft.AspNetCore.NodeServices/HostingModels/HttpNodeInstance.cs @@ -50,6 +50,7 @@ public HttpNodeInstance(NodeServicesOptions options, int port = 0) options.DebuggingPort) { _client = new HttpClient(); + _client.Timeout = TimeSpan.FromMilliseconds(options.InvocationTimeoutMilliseconds + 1000); } private static string MakeCommandLineOptions(int port)