相关疑难解决方法(0)

ASP.NET核心 - 提供静态文件

我正在关注此文档,但我遇到了困难:https: //docs.microsoft.com/en-us/aspnet/core/fundamentals/static-files

考虑我的目录结构:

wwwroot
    dist
        index.html
Run Code Online (Sandbox Code Playgroud)

在我的启动课上,我有:

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"))
    });
}
Run Code Online (Sandbox Code Playgroud)

当我启动应用程序时,我没有看到我的index.html页面,但是如果我导航到,我会这样做 <host>/dist/index.html

如何配置它以便ASP.NET自动将我带到该页面<host>

c# static-files asp.net-core

4
推荐指数
1
解决办法
8379
查看次数

标签 统计

asp.net-core ×1

c# ×1

static-files ×1