diff --git a/src/Orchard/Mvc/MvcModule.cs b/src/Orchard/Mvc/MvcModule.cs index 5d7a84cf5..a1cd3a110 100644 --- a/src/Orchard/Mvc/MvcModule.cs +++ b/src/Orchard/Mvc/MvcModule.cs @@ -39,7 +39,10 @@ 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); + var baseUrl = new Func(() => + siteService.GetSiteSettings().BaseUrl + ?? "http://localhost" /* When Setup is running from the command line, no BaseUrl exists yet. */); + var httpContextBase = new HttpContextPlaceholder(baseUrl); return httpContextBase;