为什么网站默认不默认index.html?
Why doesn't the website default to index.html by default?
我无法输入域名来观察着陆页:
http://some_url.com
错误:
Could not find file 'E:\index.html'.
但是,以下是有效的:
仅供参考:
本网站是使用 Elm、Giraffe 和 .Net Core 构建的。
如果您是 运行 Giraffe,那么您就是 运行 F#,这意味着您很有可能正在使用 IApplicationBuilder
配置您的服务器。您应该可以调用 UseDefaultFiles
,然后调用 UseStaticFiles
以使用 index.html 作为默认文档。
let configureApp (app : IApplicationBuilder) =
app.UseGiraffeErrorHandler errorHandler
app.UseDefaultFiles() |> ignore
app.UseStaticFiles() |> ignore
app.UseGiraffe webApp
UseDefaultFiles
must be called before UseStaticFiles
to serve the default file. UseDefaultFiles
is a URL re-writer that doesn't actually serve the file. You must enable the static file middleware (UseStaticFiles
) to serve the file.
我没有指定以下内容:
let webApp: HttpHandler =
choose [
GET >=>
choose [
route "/" >=> htmlFile "index.html"
我无法输入域名来观察着陆页:
http://some_url.com
错误:
Could not find file 'E:\index.html'.
但是,以下是有效的:
仅供参考: 本网站是使用 Elm、Giraffe 和 .Net Core 构建的。
如果您是 运行 Giraffe,那么您就是 运行 F#,这意味着您很有可能正在使用 IApplicationBuilder
配置您的服务器。您应该可以调用 UseDefaultFiles
,然后调用 UseStaticFiles
以使用 index.html 作为默认文档。
let configureApp (app : IApplicationBuilder) =
app.UseGiraffeErrorHandler errorHandler
app.UseDefaultFiles() |> ignore
app.UseStaticFiles() |> ignore
app.UseGiraffe webApp
UseDefaultFiles
must be called beforeUseStaticFiles
to serve the default file.UseDefaultFiles
is a URL re-writer that doesn't actually serve the file. You must enable the static file middleware (UseStaticFiles
) to serve the file.
我没有指定以下内容:
let webApp: HttpHandler =
choose [
GET >=>
choose [
route "/" >=> htmlFile "index.html"