diff --git a/src/Umbraco.Core/Configuration/UmbracoSettings/IKeepAliveSection.cs b/src/Umbraco.Core/Configuration/UmbracoSettings/IKeepAliveSection.cs
new file mode 100644
index 0000000000..3a0ad258c5
--- /dev/null
+++ b/src/Umbraco.Core/Configuration/UmbracoSettings/IKeepAliveSection.cs
@@ -0,0 +1,8 @@
+namespace Umbraco.Core.Configuration.UmbracoSettings
+{
+ public interface IKeepAliveSection : IUmbracoConfigurationSection
+ {
+ bool DisableKeepAliveTask { get; }
+ string KeepAlivePingUrl { get; }
+ }
+}
diff --git a/src/Umbraco.Core/Configuration/UmbracoSettings/IUmbracoSettingsSection.cs b/src/Umbraco.Core/Configuration/UmbracoSettings/IUmbracoSettingsSection.cs
index 81d27e7bae..acd9c92588 100644
--- a/src/Umbraco.Core/Configuration/UmbracoSettings/IUmbracoSettingsSection.cs
+++ b/src/Umbraco.Core/Configuration/UmbracoSettings/IUmbracoSettingsSection.cs
@@ -15,5 +15,7 @@ namespace Umbraco.Core.Configuration.UmbracoSettings
ILoggingSection Logging { get; }
IWebRoutingSection WebRouting { get; }
+
+ IKeepAliveSection KeepAlive { get; }
}
}
diff --git a/src/Umbraco.Core/Configuration/UmbracoSettings/KeepAliveElement.cs b/src/Umbraco.Core/Configuration/UmbracoSettings/KeepAliveElement.cs
new file mode 100644
index 0000000000..89ba9be54d
--- /dev/null
+++ b/src/Umbraco.Core/Configuration/UmbracoSettings/KeepAliveElement.cs
@@ -0,0 +1,13 @@
+using System.Configuration;
+
+namespace Umbraco.Core.Configuration.UmbracoSettings
+{
+ internal class KeepAliveElement : ConfigurationElement, IKeepAliveSection
+ {
+ [ConfigurationProperty("disableKeepAliveTask", DefaultValue = "false")]
+ public bool DisableKeepAliveTask => (bool)base["disableKeepAliveTask"];
+
+ [ConfigurationProperty("keepAlivePingUrl", DefaultValue = "{umbracoApplicationUrl}/api/keepalive/ping")]
+ public string KeepAlivePingUrl => (string)base["keepAlivePingUrl"];
+ }
+}
diff --git a/src/Umbraco.Core/Configuration/UmbracoSettings/UmbracoSettingsSection.cs b/src/Umbraco.Core/Configuration/UmbracoSettings/UmbracoSettingsSection.cs
index 7cf8096345..17430c81eb 100644
--- a/src/Umbraco.Core/Configuration/UmbracoSettings/UmbracoSettingsSection.cs
+++ b/src/Umbraco.Core/Configuration/UmbracoSettings/UmbracoSettingsSection.cs
@@ -19,10 +19,12 @@ namespace Umbraco.Core.Configuration.UmbracoSettings
[ConfigurationProperty("logging")]
internal LoggingElement Logging => (LoggingElement)this["logging"];
-
[ConfigurationProperty("web.routing")]
internal WebRoutingElement WebRouting => (WebRoutingElement)this["web.routing"];
+ [ConfigurationProperty("keepAlive")]
+ internal KeepAliveElement KeepAlive => (KeepAliveElement)this["keepAlive"];
+
IContentSection IUmbracoSettingsSection.Content => Content;
ISecuritySection IUmbracoSettingsSection.Security => Security;
@@ -34,5 +36,7 @@ namespace Umbraco.Core.Configuration.UmbracoSettings
ILoggingSection IUmbracoSettingsSection.Logging => Logging;
IWebRoutingSection IUmbracoSettingsSection.WebRouting => WebRouting;
+
+ IKeepAliveSection IUmbracoSettingsSection.KeepAlive => KeepAlive;
}
}
diff --git a/src/Umbraco.Core/Umbraco.Core.csproj b/src/Umbraco.Core/Umbraco.Core.csproj
index 614ab4643f..bbe773644e 100755
--- a/src/Umbraco.Core/Umbraco.Core.csproj
+++ b/src/Umbraco.Core/Umbraco.Core.csproj
@@ -352,6 +352,7 @@
+
@@ -361,6 +362,7 @@
+
diff --git a/src/Umbraco.Web.UI/config/umbracoSettings.config b/src/Umbraco.Web.UI/config/umbracoSettings.config
index fa998a9856..9e60a9499c 100644
--- a/src/Umbraco.Web.UI/config/umbracoSettings.config
+++ b/src/Umbraco.Web.UI/config/umbracoSettings.config
@@ -1,245 +1,258 @@
-
-
-
-
-
-
-
-
-
-
-
-
- 1
-
-
-
-
-
-
-
- your@email.here
-
-
-
-
-
-
-
- …
-
-
-
-
-
-
- ]]>
-
-
-
- throw
-
-
- ashx,aspx,ascx,config,cshtml,vbhtml,asmx,air,axd,swf,xml,xhtml,html,htm,php,htaccess
-
-
- assets/img/login.jpg
-
-
-
-
-
- false
-
- true
-
- false
-
-
-
-
-
-
-
-
-
-
-
-
+
+
+
+
+
+
+
+
+
+
+
+
+ 1
+
+
+
+
+
+
+
+ your@email.here
+
+
+
+
+
+
+
+ …
+
+
+
+
+
+
+ ]]>
+
+
+
+ throw
+
+
+ ashx,aspx,ascx,config,cshtml,vbhtml,asmx,air,axd,swf,xml,xhtml,html,htm,php,htaccess
+
+
+ assets/img/login.jpg
+
+
+
+
+
+ false
+
+ true
+
+ false
+
+
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/src/Umbraco.Web/Scheduling/KeepAlive.cs b/src/Umbraco.Web/Scheduling/KeepAlive.cs
index c07430df04..9a22c59566 100644
--- a/src/Umbraco.Web/Scheduling/KeepAlive.cs
+++ b/src/Umbraco.Web/Scheduling/KeepAlive.cs
@@ -3,6 +3,8 @@ using System.Net.Http;
using System.Threading;
using System.Threading.Tasks;
using Umbraco.Core;
+using Umbraco.Core.Composing;
+using Umbraco.Core.Configuration.UmbracoSettings;
using Umbraco.Core.Logging;
using Umbraco.Core.Sync;
@@ -11,14 +13,16 @@ namespace Umbraco.Web.Scheduling
internal class KeepAlive : RecurringTaskBase
{
private readonly IRuntimeState _runtime;
+ private readonly IKeepAliveSection _keepAliveSection;
private readonly IProfilingLogger _logger;
private static HttpClient _httpClient;
public KeepAlive(IBackgroundTaskRunner runner, int delayMilliseconds, int periodMilliseconds,
- IRuntimeState runtime, IProfilingLogger logger)
+ IRuntimeState runtime, IKeepAliveSection keepAliveSection, IProfilingLogger logger)
: base(runner, delayMilliseconds, periodMilliseconds)
{
_runtime = runtime;
+ _keepAliveSection = keepAliveSection;
_logger = logger;
if (_httpClient == null)
_httpClient = new HttpClient();
@@ -46,25 +50,27 @@ namespace Umbraco.Web.Scheduling
using (_logger.DebugDuration("Keep alive executing", "Keep alive complete"))
{
- string umbracoAppUrl = null;
-
+ var keepAlivePingUrl = _keepAliveSection.KeepAlivePingUrl;
try
{
- umbracoAppUrl = _runtime.ApplicationUrl.ToString();
- if (umbracoAppUrl.IsNullOrWhiteSpace())
+ if (keepAlivePingUrl.Contains("{umbracoApplicationUrl}"))
{
- _logger.Warn("No url for service (yet), skip.");
- return true; // repeat
+ var umbracoAppUrl = _runtime.ApplicationUrl.ToString();
+ if (umbracoAppUrl.IsNullOrWhiteSpace())
+ {
+ _logger.Warn("No umbracoApplicationUrl for service (yet), skip.");
+ return true; // repeat
+ }
+
+ keepAlivePingUrl = keepAlivePingUrl.Replace("{umbracoApplicationUrl}", umbracoAppUrl.TrimEnd('/'));
}
- var url = umbracoAppUrl.TrimEnd('/') + "/api/keepalive/ping";
-
- var request = new HttpRequestMessage(HttpMethod.Get, url);
+ var request = new HttpRequestMessage(HttpMethod.Get, keepAlivePingUrl);
var result = await _httpClient.SendAsync(request, token);
}
catch (Exception ex)
{
- _logger.Error(ex, "Keep alive failed (at '{UmbracoAppUrl}').", umbracoAppUrl);
+ _logger.Error(ex, "Keep alive failed (at '{keepAlivePingUrl}').", keepAlivePingUrl);
}
}
diff --git a/src/Umbraco.Web/Scheduling/SchedulerComponent.cs b/src/Umbraco.Web/Scheduling/SchedulerComponent.cs
index 1416393f46..a08289186f 100644
--- a/src/Umbraco.Web/Scheduling/SchedulerComponent.cs
+++ b/src/Umbraco.Web/Scheduling/SchedulerComponent.cs
@@ -99,7 +99,11 @@ namespace Umbraco.Web.Scheduling
var tasks = new List();
- tasks.Add(RegisterKeepAlive());
+ if (settings.KeepAlive.DisableKeepAliveTask == false)
+ {
+ tasks.Add(RegisterKeepAlive(settings.KeepAlive));
+ }
+
tasks.Add(RegisterScheduledPublishing());
tasks.Add(RegisterLogScrubber(settings));
tasks.Add(RegisterTempFileCleanup());
@@ -112,11 +116,11 @@ namespace Umbraco.Web.Scheduling
});
}
- private IBackgroundTask RegisterKeepAlive()
+ private IBackgroundTask RegisterKeepAlive(IKeepAliveSection keepAliveSection)
{
// ping/keepalive
// on all servers
- var task = new KeepAlive(_keepAliveRunner, DefaultDelayMilliseconds, FiveMinuteMilliseconds, _runtime, _logger);
+ var task = new KeepAlive(_keepAliveRunner, DefaultDelayMilliseconds, FiveMinuteMilliseconds, _runtime, keepAliveSection, _logger);
_keepAliveRunner.TryAdd(task);
return task;
}