📜  子目录中的 dotnet core vue - C# 代码示例

📅  最后修改于: 2022-03-11 14:48:40.541000             🧑  作者: Mango

代码示例1
public void ConfigureServices(IServiceCollection services) {
    ...
    services.AddSpaStaticFiles(configuration => { configuration.RootPath = "wwwroot"; });
    ...
}

public void Configure(IApplicationBuilder app, IHostingEnvironment env) {
    ...
    app.Map(
        "/<>",
        builder =>
        {
            builder.UseSpa(spa =>
            {
                if (env.IsDevelopment())
                {
                    spa.Options.SourcePath = "<>";
                    spa.UseAngularCliServer(npmScript: "start-dotnet");
                }
                else
                {
                    spa.Options.SourcePath = "wwwroot/<>";
                    spa.Options.DefaultPageStaticFileOptions = new StaticFileOptions
                    {
                        FileProvider = new PhysicalFileProvider(Path.Combine(Directory.GetCurrentDirectory(), "wwwroot/<>"))
                    };
                }
            });
        }
    );
    ...
}