I'm trying to set up an ASP .NET Core Web site to host an AngularJS application.
The structure that my "index" page is using is:
/wwwroot/app/index.html
I tried some settings in the Startup.cs file, like this:
app.UseStaticFiles(new StaticFileOptions()
{
FileProvider = new PhysicalFileProvider(
Path.Combine(Directory.GetCurrentDirectory(), @"wwwroot", "app"))
});
And also tried the following configuration in the Main method:
var host = new WebHostBuilder()
.UseKestrel()
.UseContentRoot(Path.Combine(Directory.GetCurrentDirectory(), @"wwwroot", "app"))
.UseIISIntegration()
.UseStartup<Startup>()
.Build();
Even with both settings above, I still need to navigate the URL link to render the Index.html file.
I want the Index.html file to be rendered when I navigate to the root URL link
EDIT:
I just found the solution. You need to add this to the WebHostBuilder call:
.UseWebRoot(Path.Combine(Directory.GetCurrentDirectory(), @"wwwroot", "app"))