Blazor dev server: serve all files (#20355)

* Serve all files in development. Fixes #19931

* Dev server code tidy
This commit is contained in:
Steve Sanderson 2020-03-31 16:08:22 +01:00 committed by GitHub
parent 05ee136e87
commit aeff119dc4
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 7 additions and 10 deletions

View File

@ -1,15 +1,8 @@
// Copyright (c) .NET Foundation. All rights reserved.
// Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information.
using System;
using System.IO;
using System.Linq;
using System.Net.Mime;
using Microsoft.AspNetCore.Builder;
using Microsoft.AspNetCore.Components.Server;
using Microsoft.AspNetCore.Hosting;
using Microsoft.AspNetCore.Http;
using Microsoft.AspNetCore.ResponseCompression;
using Microsoft.Extensions.Configuration;
using Microsoft.Extensions.DependencyInjection;
@ -27,10 +20,9 @@ namespace Microsoft.AspNetCore.Components.WebAssembly.DevServer.Server
public void ConfigureServices(IServiceCollection services)
{
services.AddRouting();
}
public void Configure(IApplicationBuilder app, IWebHostEnvironment environment, IConfiguration configuration)
public void Configure(IApplicationBuilder app, IConfiguration configuration)
{
app.UseDeveloperExceptionPage();
EnableConfiguredPathbase(app, configuration);
@ -38,7 +30,12 @@ namespace Microsoft.AspNetCore.Components.WebAssembly.DevServer.Server
app.UseWebAssemblyDebugging();
app.UseBlazorFrameworkFiles();
app.UseStaticFiles();
app.UseStaticFiles(new StaticFileOptions
{
// In development, serve everything, as there's no other way to configure it.
// In production, developers are responsible for configuring their own production server
ServeUnknownFileTypes = true,
});
app.UseRouting();