1
I am trying to set up an ASP site . NET Core, to host an Angularjs application.
The structure my "index" page is using is:
/wwwroot/app/index.html
I tried some settings in the Startup.Cs file, like this one:
app.UseStaticFiles(new StaticFileOptions()
{
FileProvider = new PhysicalFileProvider(
Path.Combine(Directory.GetCurrentDirectory(), @"wwwroot", "app"))
});
And I 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 browse the URL http://localhost:PORT/app to render the Index.html file.
I want the Index.html file to be rendered when I navigate to the root URL http://localhost:PORT/
EDIT:
I just found the solution. It is necessary to add this in the Webhostbuilder call:
.UseWebRoot(Path.Combine(Directory.GetCurrentDirectory(), @"wwwroot", "app"))
Add an answer to your own question, I think it might be useful for more people.
– perozzo
Have you ever tried to tamper with the routing rules of the application?
– Robson Silva