Get Even More Visitors To Your Blog, Upgrade To A Business Listing >>

SOLVED: ContentRootPath different in Development and Azure web app

James Woodall:

When I deploy my Dot Net Core Web App to Azure, the Environment.ContentRootPath variable is set to [myproject]/wwwroot. However, in development, it is just [myproject].

Why does it change in Azure deployment?

How can I make it consistent?

For reference, this is my IWebHost.


public static IWebHost BuildWebHost(string[] args) =>
WebHost.CreateDefaultBuilder(args)
.ConfigureAppConfiguration((builderContext, config) =>
{
var env = builderContext.HostingEnvironment;

config.AddJsonFile("appsettings.json", false, true)
.AddJsonFile($"appsettings.{env.EnvironmentName}.json", true, true);

if (env.IsDevelopment())
config.AddUserSecrets();

config.AddEnvironmentVariables();
})
.UseSetting("detailedErrors", "true")
.UseApplicationInsights()
.UseStartup()
.CaptureStartupErrors(true)
.Build();



Posted in S.E.F
via StackOverflow & StackExchange Atomic Web Robots
This Question have been answered
HERE


This post first appeared on Stack Solved, please read the originial post: here

Share the post

SOLVED: ContentRootPath different in Development and Azure web app

×

Subscribe to Stack Solved

Get updates delivered right to your inbox!

Thank you for your subscription

×