I just came around the problem that I wanted to serve static files via Owin. Therefore I added the NuGet package Microsoft.Owin.StaticFiles, and added the following to my Startup class:
1 2 3 4 5 | app.UseStaticFiles(); app.UseDefaultFiles( new DefaultFilesOptions { DefaultFileNames = new [] { "index.html" } }); |
With this, I was able to serve static files, but the default document didn’t work. I always got a HTTP 404 response. Even though I saw the access to the file in the Process Monitor. Finally, I found the solution in one of the answers to a question of Stack Overflow. I had to call UseDefaultFiles first! Before UseStaticFiles:
1 2 3 4 5 | app.UseDefaultFiles( new DefaultFilesOptions { DefaultFileNames = new [] { "index.html" } }); app.UseStaticFiles(); |
No comments:
Post a Comment
Note: Only a member of this blog may post a comment.