Why blazor app doesn't work when i change root to folder "_framework"

asp.net-core blazor


I change my base href in index.html: was href="/" has become href="/schedule/"

Also i change Configure:

            app.UseStaticFiles(new StaticFileOptions()
                FileProvider = new PhysicalFileProvider(Path.Combine(Directory.GetCurrentDirectory(),@"Schedule.Client", @"dist")),
                RequestPath = new PathString("/schedule")

Here located my files

Here located my files:

css, js, resources work good, but _framework which includes wasm files and doesn't work correct.


<!DOCTYPE html>
    <meta charset="utf-8" />
    <meta name="viewport" content="width=device-width">
    <link rel="icon" href="css/Resources/icon_title.png" />
    <base href="/schedule/" />
    <link href="css/bootstrap/bootstrap.min.css" rel="stylesheet" />
    <link rel="stylesheet" href="https://use.fontawesome.com/releases/v5.2.0/css/all.css" crossorigin="anonymous">
    <link href="css/site.css" rel="stylesheet" />
    <link href="css/btnstyle.css" rel="stylesheet" />
    <script src="js/SetScroll.js"></script>

        <div id="demo" style="margin:auto; top:30px;">
            <img src="css/Resources/logo-fin.png" />
            <div class="circle fas fa-spinner"></div>

    <script src="_framework/blazor.webassembly.js"></script>
    <script defer src="https://use.fontawesome.com/releases/v5.2.0/js/all.js" crossorigin="anonymous"></script>

When I start my app, I get error enter image description here

When i use href="/", all is correct

What could be wrong? Thanks!


I have found the same problem and solution, but there is used a Azure CLI: https://anthonychu.ca/post/blazor-azure-storage-static-websites/

enter image description here

9/14/2018 11:47:48 AM

Accepted Answer

I asked this question on github and get a answer. You should use a method to set a correct root: https://github.com/aspnet/Blazor/issues/1421

app.Map("/schedule", subdirApp =>

I wrote this code in Server.Startup. In UseBlazor i have written Client.Startup.

9/17/2018 7:45:26 AM

Related Questions

Licensed under: CC-BY-SA with attribution
Not affiliated with Stack Overflow
Licensed under: CC-BY-SA with attribution
Not affiliated with Stack Overflow