When you change the download location of static files, it does not change where the default files are downloaded from.
If you look at the actual middleware code on Github: https://github.com/damianh/StaticFilesMiddleware/blob/475aef7f56b92d6420ec700dcb397841b6842ed8/src/Microsoft.Owin.StaticFiles/DefaultFilesMiddleware.cs
You can see that it is still trying to download the file manually. It does not care what parameters you set for StaticFiles. Mostly because I assume that you might have a default page without using the middleware static files.
Remember that when calling app.UseDefaultFiles () it is middleware, not customization. It actually βdoesβ something to try to return this file to you.
In any case, if you want to use a non-standard folder to load the default page, you just need to go to the same provider. For example, this code should work well for you:
DefaultFilesOptions defaultFilesOptions = new DefaultFilesOptions(); defaultFilesOptions.DefaultFileNames.Clear(); defaultFilesOptions.DefaultFileNames.Add("angulardev.html"); defaultFilesOptions.FileProvider = new PhysicalFileProvider(Path.Combine(Directory.GetCurrentDirectory(), @"angular", @"src")); defaultFilesOptions.RequestPath = new PathString(""); app.UseDefaultFiles(defaultFilesOptions); app.UseStaticFiles(new StaticFileOptions() { FileProvider = new PhysicalFileProvider(Path.Combine(Directory.GetCurrentDirectory(), @"angular", @"src")), RequestPath = new PathString("") });
source share