【发布时间】:2017-02-16 16:53:53
【问题描述】:
我目前在一个文件夹中生成了 index.html、js 和其他静态文件,我将该文件夹标记为静态文件夹(通过在 Startup.cs 的 Configure 方法中添加以下内容:
app.UseDefaultFiles();
app.UseStaticFiles(new StaticFileOptions()
{
FileProvider = new Path.Combine(env.ContentRootPath, @"../build")),
RequestPath = new PathString("/app/")
});
有没有办法将 index.html 设置为此 */app 路由的默认响应?因为现在 localhost:5000/app/ 返回 404 而 localhost:5000/app/index.html 返回 index.html。
编辑:我错过了提到我确实尝试使用 app.UseDefaultFiles() 就像docs 中提到的那样,但它对我不起作用。服务器仍然返回 404
【问题讨论】:
标签: c# asp.net asp.net-mvc asp.net-core