Skip to content

IWebHostEnvironment missing static assets from referenced projects #26

Description

@stevebelskie

To try out featherhttp and see if it would work with Blazor WebAssembly, I created a new project using the Blazor Wasm template for 3.2 RC with an Asp.NET Core host. I just deleted the startup for the server host and changed Program.cs to following:

            builder.Services.AddControllersWithViews();
            builder.Services.AddRazorPages();
            var app = builder.Build();

            app.UseBlazorFrameworkFiles();
            app.UseStaticFiles();

            app.MapRazorPages();
            app.MapControllers();
            app.MapFallbackToFile("index.html");
           
            app.Run();

Running the program results in a 404. Stepping into app.UseBlazorFrameworkFiles shows that the webHostEnvironment has a NullFileProvider instead of the CompositeFileProvider (with the path to the static content for the referenced Blazor client project) that I would expect and which is correctly populated if you use the template as is.

Interestingly (or maybe not), calling GetServices returns two entires, one of which seems to have the correct WebRootFileProvider. This is not the environment, however, resolved inside app.UseBlazorFrameworkFiles.

Is this the expected behavior? I attempted to work through the source here, and for the standard WebHostBuilder to see what was happening, but couldn't quite pinpoint where they diverge. Is this possibly related to the changes for #19 and/or the use of the deferred host?

I can provide more information/clarification if needed.

Thanks!

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions