/// Ensures that the property has a value.
@@ -117,18 +112,6 @@ namespace Umbraco.Core
ApplicationUrl = new Uri(ApplicationUrlHelper.GetApplicationUrl(_logger, _globalSettings, _settings, ServerRegistrar, request));
}
- private readonly ManualResetEventSlim _runLevel = new ManualResetEventSlim(false);
-
- ///
- /// Waits for the runtime level to become RuntimeLevel.Run.
- ///
- /// A timeout.
- /// True if the runtime level became RuntimeLevel.Run before the timeout, otherwise false.
- internal bool WaitForRunLevel(TimeSpan timeout)
- {
- return _runLevel.WaitHandle.WaitOne(timeout);
- }
-
///
public BootFailedException BootFailedException { get; internal set; }
diff --git a/src/Umbraco.Web/Routing/Resources/Booting.html b/src/Umbraco.Web/Routing/Resources/Booting.html
deleted file mode 100644
index 7980301c6a..0000000000
--- a/src/Umbraco.Web/Routing/Resources/Booting.html
+++ /dev/null
@@ -1,9 +0,0 @@
-
-
- The website is restarting
-
-
- The website is restarting
- Please wait while we prepare to serve the page you have requested...
-
-
diff --git a/src/Umbraco.Web/Routing/Resources/Failed.html b/src/Umbraco.Web/Routing/Resources/Failed.html
deleted file mode 100644
index 2f4856820d..0000000000
--- a/src/Umbraco.Web/Routing/Resources/Failed.html
+++ /dev/null
@@ -1,8 +0,0 @@
-
-
- The website cannot start
-
-
- The website failed to start :(
-
-
diff --git a/src/Umbraco.Web/Routing/Resources/HtmlPages.Designer.cs b/src/Umbraco.Web/Routing/Resources/HtmlPages.Designer.cs
deleted file mode 100644
index 206732265e..0000000000
--- a/src/Umbraco.Web/Routing/Resources/HtmlPages.Designer.cs
+++ /dev/null
@@ -1,99 +0,0 @@
-//------------------------------------------------------------------------------
-//
-// This code was generated by a tool.
-// Runtime Version:4.0.30319.42000
-//
-// Changes to this file may cause incorrect behavior and will be lost if
-// the code is regenerated.
-//
-//------------------------------------------------------------------------------
-
-namespace Umbraco.Web.Routing.Resources {
- using System;
-
-
- ///
- /// A strongly-typed resource class, for looking up localized strings, etc.
- ///
- // This class was auto-generated by the StronglyTypedResourceBuilder
- // class via a tool like ResGen or Visual Studio.
- // To add or remove a member, edit your .ResX file then rerun ResGen
- // with the /str option, or rebuild your VS project.
- [global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Resources.Tools.StronglyTypedResourceBuilder", "15.0.0.0")]
- [global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
- [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()]
- internal class HtmlPages {
-
- private static global::System.Resources.ResourceManager resourceMan;
-
- private static global::System.Globalization.CultureInfo resourceCulture;
-
- [global::System.Diagnostics.CodeAnalysis.SuppressMessageAttribute("Microsoft.Performance", "CA1811:AvoidUncalledPrivateCode")]
- internal HtmlPages() {
- }
-
- ///
- /// Returns the cached ResourceManager instance used by this class.
- ///
- [global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)]
- internal static global::System.Resources.ResourceManager ResourceManager {
- get {
- if (object.ReferenceEquals(resourceMan, null)) {
- global::System.Resources.ResourceManager temp = new global::System.Resources.ResourceManager("Umbraco.Web.Routing.Resources.HtmlPages", typeof(HtmlPages).Assembly);
- resourceMan = temp;
- }
- return resourceMan;
- }
- }
-
- ///
- /// Overrides the current thread's CurrentUICulture property for all
- /// resource lookups using this strongly typed resource class.
- ///
- [global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)]
- internal static global::System.Globalization.CultureInfo Culture {
- get {
- return resourceCulture;
- }
- set {
- resourceCulture = value;
- }
- }
-
- ///
- /// Looks up a localized string similar to <html>
- ///<head>
- /// <title>The website is restarting</title>
- ///</head>
- ///<body>
- /// <h1>The website is restarting</h1>
- /// <p>Please wait while we prepare to serve the page you have requested...</p>
- ///</body>
- ///</html>
- ///.
- ///
- internal static string Booting {
- get {
- return ResourceManager.GetString("Booting", resourceCulture);
- }
- }
-
- ///
- /// Looks up a localized string similar to <html>
- ///<head>
- /// <title>The website is restarting</title>
- ///</head>
- ///<body>
- /// <h1>The website is restarting</h1>
- /// <p>Please wait while we prepare to serve the page you have requested...</p>
- ///</body>
- ///</html>
- ///.
- ///
- internal static string Failed {
- get {
- return ResourceManager.GetString("Failed", resourceCulture);
- }
- }
- }
-}
diff --git a/src/Umbraco.Web/Routing/Resources/HtmlPages.resx b/src/Umbraco.Web/Routing/Resources/HtmlPages.resx
deleted file mode 100644
index ac636df305..0000000000
--- a/src/Umbraco.Web/Routing/Resources/HtmlPages.resx
+++ /dev/null
@@ -1,127 +0,0 @@
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- text/microsoft-resx
-
-
- 2.0
-
-
- System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089
-
-
- System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089
-
-
-
- booting.html;System.String, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089;utf-8
-
-
- failed.html;System.String, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089;utf-8
-
-
\ No newline at end of file
diff --git a/src/Umbraco.Web/Umbraco.Web.csproj b/src/Umbraco.Web/Umbraco.Web.csproj
index 91ffbe68b5..7c6cd630d1 100755
--- a/src/Umbraco.Web/Umbraco.Web.csproj
+++ b/src/Umbraco.Web/Umbraco.Web.csproj
@@ -182,11 +182,6 @@
-
- True
- True
- HtmlPages.resx
-
@@ -1210,17 +1205,11 @@
-
- ResXFileCodeGenerator
- HtmlPages.Designer.cs
-
-
-
diff --git a/src/Umbraco.Web/UmbracoInjectedModule.cs b/src/Umbraco.Web/UmbracoInjectedModule.cs
index 6da3f90ed9..95819e79d7 100644
--- a/src/Umbraco.Web/UmbracoInjectedModule.cs
+++ b/src/Umbraco.Web/UmbracoInjectedModule.cs
@@ -257,37 +257,18 @@ namespace Umbraco.Web
private bool EnsureRuntime(HttpContextBase httpContext, Uri uri)
{
- var debug = _runtime.Debug;
var level = _runtime.Level;
switch (level)
{
+ // we should never handle Unknown nor Boot: the runtime boots in Application_Start
+ // and as long as it has not booted, no request other than the initial request is
+ // going to be served (see https://stackoverflow.com/a/21402100)
+ // we should never handle BootFailed: if boot failed, the pipeline should not run
+ // at all
case RuntimeLevel.Unknown:
case RuntimeLevel.Boot:
- // not ready yet, but wait
- ReportRuntime(level, "Umbraco is booting.");
-
- // let requests pile up and wait for 10s then show the splash anyway
- //fixme: Do we want this for some insane reason? no other site in history has this
- if (((RuntimeState) _runtime).WaitForRunLevel(TimeSpan.FromSeconds(10))) return true;
-
- // redirect to booting page
- httpContext.Response.StatusCode = 503; // temp not available
- var bootHtml = Routing.Resources.HtmlPages.Booting;
- httpContext.Response.AddHeader("Retry-After", debug ? "1" : "30"); // seconds
- httpContext.Response.Write(bootHtml);
- httpContext.Response.Flush();
- return false; // cannot serve content
-
case RuntimeLevel.BootFailed:
- // redirect to death page
- ReportRuntime(level, "Umbraco has failed.");
-
- httpContext.Response.StatusCode = 503; // temp not available
- var deathHtml = Routing.Resources.HtmlPages.Failed;
- httpContext.Response.AddHeader("Retry-After", debug ? "1" : "300"); // seconds
- httpContext.Response.Write(deathHtml);
- httpContext.Response.Flush();
- return false; // cannot serve content
+ throw new Exception($"panic: Unexpected runtime level: {level}.");
case RuntimeLevel.Run:
// ok
@@ -303,7 +284,7 @@ namespace Umbraco.Web
return false; // cannot serve content
default:
- throw new NotSupportedException($"Unexpected runtime level: {Current.RuntimeState.Level}.");
+ throw new NotSupportedException($"Unexpected runtime level: {level}.");
}
}