#233 Create the wwwroot directory if it doesn't exist.
This commit is contained in:
parent
c2b638d85b
commit
736e6bee2b
|
|
@ -1,6 +1,7 @@
|
|||
// Copyright (c) .NET Foundation. All rights reserved.
|
||||
// Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information.
|
||||
|
||||
using System.IO;
|
||||
using Microsoft.AspNet.FileProviders;
|
||||
using Microsoft.AspNet.Hosting.Internal;
|
||||
|
||||
|
|
@ -11,6 +12,10 @@ namespace Microsoft.AspNet.Hosting
|
|||
public static void Initialize(this IHostingEnvironment hostingEnvironment, string applicationBasePath, string environmentName)
|
||||
{
|
||||
hostingEnvironment.WebRootPath = HostingUtilities.GetWebRoot(applicationBasePath);
|
||||
if (!Directory.Exists(hostingEnvironment.WebRootPath))
|
||||
{
|
||||
Directory.CreateDirectory(hostingEnvironment.WebRootPath);
|
||||
}
|
||||
hostingEnvironment.WebRootFileProvider = new PhysicalFileProvider(hostingEnvironment.WebRootPath);
|
||||
hostingEnvironment.EnvironmentName = environmentName ?? hostingEnvironment.EnvironmentName;
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in New Issue