[Fixes #7811] Fixes exception occurred when BaseUrl setting is not set (#7813)

Fixes #7811
This commit is contained in:
ViRuSTriNiTy
2017-08-17 21:12:02 +02:00
committed by Sébastien Ros
parent 375c935ec7
commit fc38e0eb5d

View File

@@ -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<string>(() =>
siteService.GetSiteSettings().BaseUrl
?? "http://localhost" /* When Setup is running from the command line, no BaseUrl exists yet. */);
var baseUrl = new Func<string>(() => {
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);