diff --git a/src/ServiceControlInstaller.Engine/Instances/ServiceControlBaseService.cs b/src/ServiceControlInstaller.Engine/Instances/ServiceControlBaseService.cs index e9c421642a..320cfeec87 100644 --- a/src/ServiceControlInstaller.Engine/Instances/ServiceControlBaseService.cs +++ b/src/ServiceControlInstaller.Engine/Instances/ServiceControlBaseService.cs @@ -70,7 +70,7 @@ public string AclMaintenanceUrl { get { - var baseUrl = $"http://{HostName}:{DatabaseMaintenancePort}/"; + var baseUrl = $"http://+:{DatabaseMaintenancePort}/"; return baseUrl; } } @@ -208,8 +208,17 @@ protected string DefaultLogPath() public void RemoveUrlAcl() { - foreach (var urlReservation in UrlReservation.GetAll().Where(p => p.Url.StartsWith(AclUrl, StringComparison.OrdinalIgnoreCase) || - p.Url.StartsWith(AclMaintenanceUrl, StringComparison.OrdinalIgnoreCase))) + //This is an old aclurl registration for embedded RavenDB instance that includes the hostname. + //We need that to make sure we can clean-up old registration when removing instances created + //using pre 4.17 versions of ServiceControl. + var legacyAclMaintenanceUrl = $"http://{HostName}:{DatabaseMaintenancePort}/"; + + bool IsServiceControlAclUrl(UrlReservation r) => + r.Url.StartsWith(AclUrl, StringComparison.OrdinalIgnoreCase) || + r.Url.StartsWith(AclMaintenanceUrl, StringComparison.OrdinalIgnoreCase) || + r.Url.StartsWith(legacyAclMaintenanceUrl, StringComparison.OrdinalIgnoreCase); + + foreach (var urlReservation in UrlReservation.GetAll().Where(IsServiceControlAclUrl)) { try { diff --git a/src/ServiceControlInstaller.Engine/Instances/ServiceControlNewInstance.cs b/src/ServiceControlInstaller.Engine/Instances/ServiceControlNewInstance.cs index 6d02fd9d3b..b39d2aa6f1 100644 --- a/src/ServiceControlInstaller.Engine/Instances/ServiceControlNewInstance.cs +++ b/src/ServiceControlInstaller.Engine/Instances/ServiceControlNewInstance.cs @@ -225,7 +225,7 @@ public string AclMaintenanceUrl { get { - var baseUrl = $"http://{HostName}:{DatabaseMaintenancePort}/"; + var baseUrl = $"http://+:{DatabaseMaintenancePort}/"; return baseUrl; } } diff --git a/src/ServiceControlInstaller.PowerShell/Cmdlets/AuditInstances/NewServiceControlAuditInstance.cs b/src/ServiceControlInstaller.PowerShell/Cmdlets/AuditInstances/NewServiceControlAuditInstance.cs index b3f1b776a4..ad0615a93c 100644 --- a/src/ServiceControlInstaller.PowerShell/Cmdlets/AuditInstances/NewServiceControlAuditInstance.cs +++ b/src/ServiceControlInstaller.PowerShell/Cmdlets/AuditInstances/NewServiceControlAuditInstance.cs @@ -1,7 +1,6 @@ namespace ServiceControlInstaller.PowerShell { using System; - using System.IO; using System.Linq; using System.Management.Automation; using Engine.Instances;