Closed space-alien closed 6 years ago
UseDefaultFiles and UseStaticFiles need to use the same FileProvider so they're both looking in the same place. UseFileSystem is a good shortcut for this, or you can change the default in IHostingEnvironment.WebRootFileProvider.
Thank you, that makes sense.
I think you might have meant UseFileServer
in your comment above.
Yes, UseFileServer
I want to serve static files from a different folder than
wwwroot
. Let's pretend this folder is namedstatics
.Let's say my default document is
index.html
.For some reason, the following code results in a 404 if the default document is requested... UNLESS I place a redundant
index.html
file in thewwwroot
folder in my project. (This file must have the same name as the one I want to serve from mystatics
folder.)Once that's done, the
index.html
file in mystatics
folder is served as desired. It's as if the server is checking for file existence inwwwroot
in spite of theStaticFileOptions
.