mirror of
https://github.com/OrchardCMS/Orchard.git
synced 2026-02-09 09:16:41 +08:00
Falling back to a default base URL in case none is configured.
This fixes an issue where you run Setup from a command line and the recipe does not set BaseUrl on site settings. The issue is that if the HttpContext does not have a URL, certain properties on the Request object will throw when constructing a URI with a null value.
This commit is contained in:
@@ -21,7 +21,8 @@ namespace Orchard.Mvc {
|
||||
|
||||
public HttpContextBase CreateContext(ILifetimeScope lifetimeScope) {
|
||||
return new MvcModule.HttpContextPlaceholder(_threadStaticContexts, _contextKey, () => {
|
||||
return lifetimeScope.Resolve<ISiteService>().GetSiteSettings().BaseUrl;
|
||||
var baseUrl = lifetimeScope.Resolve<ISiteService>().GetSiteSettings().BaseUrl;
|
||||
return !String.IsNullOrEmpty(baseUrl) ? baseUrl : "http://localhost"; // Return a valid URL always.
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user