.net Core - StaticFiles with custom DefaultFiles-Definitions

Viewed 1749

I have the following project hierarchy:

-MyDotNetProject
 ...
 L wwwroot
 L angular
   L src
     L angulardev.html
     L index.html

and now I want to use angulardev.html as the starting point when starting the application.

I tried following in Startup.cs/Configure but it does not work.

DefaultFilesOptions defaultFilesOptions = new DefaultFilesOptions();
defaultFilesOptions.DefaultFileNames.Clear();
defaultFilesOptions.DefaultFileNames.Add("angulardev.html");
app.UseDefaultFiles(defaultFilesOptions);

var path = Path.Combine(env.ContentRootPath, "angular/src"); 
var provider = new PhysicalFileProvider(path);
var options = new StaticFileOptions();
options.RequestPath = "";
options.FileProvider = provider;
app.UseStaticFiles(options);
3 Answers
Related