diff --git a/src/Orchard/Mvc/MvcModule.cs b/src/Orchard/Mvc/MvcModule.cs index 772eec403..93d69fa8d 100644 --- a/src/Orchard/Mvc/MvcModule.cs +++ b/src/Orchard/Mvc/MvcModule.cs @@ -40,9 +40,12 @@ namespace Orchard.Mvc { // which requires activating the Site content item, which in turn requires a UrlHelper, which in turn requires a RequestContext, // thus preventing a StackOverflowException. - var baseUrl = new Func(() => - siteService.GetSiteSettings().BaseUrl - ?? "http://localhost" /* When Setup is running from the command line, no BaseUrl exists yet. */); + var baseUrl = new Func(() => { + var s = siteService.GetSiteSettings().BaseUrl; + + // When Setup is running from the command line, no BaseUrl exists yet. + return string.IsNullOrEmpty(s) ? "http://localhost" : s; + }); var httpContextBase = new HttpContextPlaceholder(baseUrl);