From 05eb6a7f7c72bfec63f3c65f63a2f020fe22e705 Mon Sep 17 00:00:00 2001 From: Pavel Krymets Date: Thu, 2 Aug 2018 16:51:00 -0700 Subject: [PATCH] Add ERROR_SHARING_VIOLATION to retry list for IISDeployer.Start (#1147) --- .../IISApplication.cs | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/src/Microsoft.AspNetCore.Server.IntegrationTesting.IIS/IISApplication.cs b/src/Microsoft.AspNetCore.Server.IntegrationTesting.IIS/IISApplication.cs index 4a3caadd8e..81cebf1568 100644 --- a/src/Microsoft.AspNetCore.Server.IntegrationTesting.IIS/IISApplication.cs +++ b/src/Microsoft.AspNetCore.Server.IntegrationTesting.IIS/IISApplication.cs @@ -20,6 +20,7 @@ namespace Microsoft.AspNetCore.Server.IntegrationTesting internal class IISApplication { internal const int ERROR_OBJECT_NOT_FOUND = unchecked((int)0x800710D8); + internal const int ERROR_SHARING_VIOLATION = unchecked((int)0x80070020); private static readonly TimeSpan _timeout = TimeSpan.FromSeconds(10); private static readonly TimeSpan _retryDelay = TimeSpan.FromMilliseconds(200); @@ -109,7 +110,10 @@ namespace Microsoft.AspNetCore.Server.IntegrationTesting _logger.LogInformation($"Tried to start site, state: {state.ToString()}"); } } - catch (Exception ex) when (ex is DllNotFoundException || (ex is COMException && ex.HResult == ERROR_OBJECT_NOT_FOUND) ) + catch (Exception ex) when ( + ex is DllNotFoundException || + ex is COMException && + (ex.HResult == ERROR_OBJECT_NOT_FOUND || ex.HResult == ERROR_SHARING_VIOLATION)) { // Accessing the site.State property while the site // is starting up returns the COMException