【发布时间】:2018-07-11 04:02:40
【问题描述】:
我正在关注此文档,但我遇到了困难: https://docs.microsoft.com/en-us/aspnet/core/fundamentals/static-files
考虑我的目录结构:
wwwroot
dist
index.html
在我的创业课上,我有:
public void Configure(IApplicationBuilder app, IHostingEnvironment env)
{
if (env.IsDevelopment())
{
app.UseDeveloperExceptionPage();
}
app.UseDefaultFiles();
app.UseStaticFiles();
app.UseStaticFiles(new StaticFileOptions
{
FileProvider = new PhysicalFileProvider(Path.Combine(Directory.GetCurrentDirectory(), "wwwroot", "dist"))
});
}
当我启动应用程序时,我看不到我的 index.html 页面,但如果我导航到 <host>/dist/index.html,我就会看到
如何配置它,以便 ASP.NET 自动将我从 <host> 带到该页面?
【问题讨论】:
标签: c# asp.net-core static-files