How to set default static web page for Katana/Owin self hosted app?

前端 未结 5 1754
佛祖请我去吃肉
佛祖请我去吃肉 2020-12-29 07:34

I\'ve set up a web site using an Owin self hosted console app. I\'m serving static files with no problem, the \'root\' of the static part of the site works properly, and th

5条回答
  •  猫巷女王i
    2020-12-29 07:51

    Maybe it's a late answer, but if you need just a default document, less code will work:

    builder.UseDefaultFiles(new DefaultFilesOptions
    {
        DefaultFileNames = Enumerable.Repeat("index.html", 1).ToList()
    });
    

    It should be called before builder.UseStaticFiles for whatever reason.

    Version of Microsoft.Owin.StaticFiles is 3.0.1

提交回复
热议问题