如何调用Angular-CLI .NET Core中的index.html?

Unk*_*per 14 asp.net asp.net-mvc asp.net-core angular-cli

我使用Visual Studio 2017构建了一个Angular-CLI .Net Core SPA

dotnet new angular -o my-new-app 
Run Code Online (Sandbox Code Playgroud)

我正在努力寻找的是在写入时默认调用文件夹index.html内部的内容ClientApp/src

http://localhost:57782
Run Code Online (Sandbox Code Playgroud)

startup.cs文件如下:

using Microsoft.AspNetCore.Builder;
using Microsoft.AspNetCore.Hosting;
using Microsoft.AspNetCore.SpaServices.AngularCli;
using Microsoft.Extensions.Configuration;
using Microsoft.Extensions.DependencyInjection;

namespace angular_cli
{
    public class Startup
    {
        public Startup(IConfiguration configuration)
        {
            Configuration = configuration;
        }

        public IConfiguration Configuration { get; }

        // This method gets called by the runtime. Use this method to add services to the container.
        public void ConfigureServices(IServiceCollection services)
        {
            //services.AddMvc();

            // In production, the Angular files will be served from this directory
            services.AddSpaStaticFiles(configuration =>
            {
                configuration.RootPath = "ClientApp/dist";
            });
        }

        // This method gets called by the runtime. Use this method to configure the HTTP request pipeline.
        public void Configure(IApplicationBuilder app, IHostingEnvironment env)
        {
            if (env.IsDevelopment())
            {
                app.UseDeveloperExceptionPage();
            }
            else
            {
                app.UseExceptionHandler("/Home/Error");
            }

            app.UseStaticFiles();
            app.UseSpaStaticFiles();

            //app.UseMvc(routes =>
            //{
            //    routes.MapRoute(
            //        name: "default",
            //        template: "{controller}/{action=Index}/{id?}");
            //});

            app.UseSpa(spa =>
            {
                // To learn more about options for serving an Angular SPA from ASP.NET Core,
                // see https://go.microsoft.com/fwlink/?linkid=864501

                spa.Options.SourcePath = "ClientApp";

                if (env.IsDevelopment())
                {
                    spa.UseAngularCliServer(npmScript: "start");
                }
            });
        }
    }
}
Run Code Online (Sandbox Code Playgroud)

故意,我已经禁用了MVC中间件,一切正常.但是,我有no idea by which mechanism and settings index.html is called...... 请问有什么好的解释吗?

Set*_*Set -1

它由注册的静态文件中间件提供

app.UseStaticFiles();
Run Code Online (Sandbox Code Playgroud)

您可以在这里阅读:Work with static files in ASP.NET Core

Github 存储库:https://github.com/aspnet/StaticFiles