From 2a61d0d98814b47450435f20bb29745f9018e3a3 Mon Sep 17 00:00:00 2001 From: Tristan Thompson Date: Fri, 14 Dec 2018 11:28:00 +0000 Subject: [PATCH] Remove/Replace ping.aspx Remove ping.aspx Add KeepAliveController to receive ping requests Update KeepAlive.cs to call new MVC route rather than ping.aspx --- src/Umbraco.Web.UI/Umbraco.Web.UI.csproj | 3 -- src/Umbraco.Web.UI/Umbraco/ping.aspx | 2 -- .../Editors/KeepAliveController.cs | 28 +++++++++++++++++++ src/Umbraco.Web/Scheduling/KeepAlive.cs | 2 +- src/Umbraco.Web/Umbraco.Web.csproj | 2 ++ 5 files changed, 31 insertions(+), 6 deletions(-) delete mode 100644 src/Umbraco.Web.UI/Umbraco/ping.aspx create mode 100644 src/Umbraco.Web/Editors/KeepAliveController.cs diff --git a/src/Umbraco.Web.UI/Umbraco.Web.UI.csproj b/src/Umbraco.Web.UI/Umbraco.Web.UI.csproj index fd1ec2d50f..f0663e54e2 100644 --- a/src/Umbraco.Web.UI/Umbraco.Web.UI.csproj +++ b/src/Umbraco.Web.UI/Umbraco.Web.UI.csproj @@ -406,9 +406,6 @@ - - Form - diff --git a/src/Umbraco.Web.UI/Umbraco/ping.aspx b/src/Umbraco.Web.UI/Umbraco/ping.aspx deleted file mode 100644 index ffb1631650..0000000000 --- a/src/Umbraco.Web.UI/Umbraco/ping.aspx +++ /dev/null @@ -1,2 +0,0 @@ -<%@ Page language="c#" AutoEventWireup="True" %> -I'm alive! \ No newline at end of file diff --git a/src/Umbraco.Web/Editors/KeepAliveController.cs b/src/Umbraco.Web/Editors/KeepAliveController.cs new file mode 100644 index 0000000000..78b1289e38 --- /dev/null +++ b/src/Umbraco.Web/Editors/KeepAliveController.cs @@ -0,0 +1,28 @@ +using System.Runtime.Serialization; +using System.Web.Http; +using Umbraco.Web.WebApi; + +namespace Umbraco.Web.Editors +{ + public class KeepAliveController : UmbracoApiController + { + [HttpGet] + public KeepAlivePingResult Ping() + { + return new KeepAlivePingResult + { + Success = true, + Message = "I'm alive!" + }; + } + } + + public class KeepAlivePingResult + { + [DataMember(Name = "success")] + public bool Success { get; set; } + + [DataMember(Name = "message")] + public string Message { get; set; } + } +} diff --git a/src/Umbraco.Web/Scheduling/KeepAlive.cs b/src/Umbraco.Web/Scheduling/KeepAlive.cs index 24f6775166..bf8610e005 100644 --- a/src/Umbraco.Web/Scheduling/KeepAlive.cs +++ b/src/Umbraco.Web/Scheduling/KeepAlive.cs @@ -59,7 +59,7 @@ namespace Umbraco.Web.Scheduling return true; // repeat } - var url = umbracoAppUrl + "/ping.aspx"; + var url = umbracoAppUrl + "api/keepalive/ping"; var request = new HttpRequestMessage(HttpMethod.Get, url); var result = await _httpClient.SendAsync(request, token); diff --git a/src/Umbraco.Web/Umbraco.Web.csproj b/src/Umbraco.Web/Umbraco.Web.csproj index d64e3dcd81..7f469ddce6 100755 --- a/src/Umbraco.Web/Umbraco.Web.csproj +++ b/src/Umbraco.Web/Umbraco.Web.csproj @@ -36,6 +36,7 @@ false latest + @@ -112,6 +113,7 @@ +