U4-6788 - refactor OriginalRequestUrl into UmbracoApplicationUrl
and fixes merge issues.
This commit is contained in:
@@ -1,10 +1,8 @@
|
||||
using System;
|
||||
using System.Net;
|
||||
using Umbraco.Core;
|
||||
using Umbraco.Core.Configuration;
|
||||
using Umbraco.Core.Configuration.UmbracoSettings;
|
||||
using Umbraco.Core.Logging;
|
||||
using Umbraco.Core.Sync;
|
||||
|
||||
namespace Umbraco.Web.Scheduling
|
||||
{
|
||||
@@ -13,32 +11,28 @@ namespace Umbraco.Web.Scheduling
|
||||
public static void Start(ApplicationContext appContext, IUmbracoSettingsSection settings)
|
||||
{
|
||||
using (DisposableTimer.DebugDuration<KeepAlive>(() => "Keep alive executing", () => "Keep alive complete"))
|
||||
{
|
||||
var umbracoBaseUrl = ServerEnvironmentHelper.GetCurrentServerUmbracoBaseUrl(
|
||||
appContext,
|
||||
settings);
|
||||
|
||||
if (string.IsNullOrWhiteSpace(umbracoBaseUrl))
|
||||
{
|
||||
var umbracoAppUrl = appContext.UmbracoApplicationUrl;
|
||||
if (umbracoAppUrl.IsNullOrWhiteSpace())
|
||||
{
|
||||
LogHelper.Warn<KeepAlive>("No url for service (yet), skip.");
|
||||
return;
|
||||
}
|
||||
else
|
||||
{
|
||||
var url = string.Format("{0}ping.aspx", umbracoBaseUrl.EnsureEndsWith('/'));
|
||||
|
||||
try
|
||||
var url = umbracoAppUrl + "/ping.aspx";
|
||||
|
||||
try
|
||||
{
|
||||
using (var wc = new WebClient())
|
||||
{
|
||||
using (var wc = new WebClient())
|
||||
{
|
||||
wc.DownloadString(url);
|
||||
}
|
||||
wc.DownloadString(url);
|
||||
}
|
||||
catch (Exception ee)
|
||||
{
|
||||
LogHelper.Error<KeepAlive>(
|
||||
string.Format("Error in ping. The base url used in the request was: {0}, see http://our.umbraco.org/documentation/Using-Umbraco/Config-files/umbracoSettings/#ScheduledTasks documentation for details on setting a baseUrl if this is in error", umbracoBaseUrl)
|
||||
}
|
||||
catch (Exception ee)
|
||||
{
|
||||
LogHelper.Error<KeepAlive>(
|
||||
string.Format("Error in ping. The base url used in the request was: {0}, see http://our.umbraco.org/documentation/Using-Umbraco/Config-files/umbracoSettings/#ScheduledTasks documentation for details on setting a baseUrl if this is in error", umbracoAppUrl)
|
||||
, ee);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user