Reputation: 194
I change my base href in index.html
: was href="/"
has become href="/schedule/"
Also i change Configure
:
app.UseStaticFiles();
app.UseStaticFiles(new StaticFileOptions()
{
FileProvider = new PhysicalFileProvider(Path.Combine(Directory.GetCurrentDirectory(),@"Schedule.Client", @"dist")),
RequestPath = new PathString("/schedule")
});
Here located my files
css, js, resources work good, but _framework which includes wasm files and doesn't work correct.
index.html:
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8" />
<meta name="viewport" content="width=device-width">
<title>Schedule</title>
<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>
</head>
<body>
<app>
<div id="demo" style="margin:auto; top:30px;">
<img src="css/Resources/logo-fin.png" />
<div class="circle fas fa-spinner"></div>
</div>
</app>
<script src="_framework/blazor.webassembly.js"></script>
<script defer src="https://use.fontawesome.com/releases/v5.2.0/js/all.js" crossorigin="anonymous"></script>
</body>
</html>
When I start my app, I get error
When i use href="/"
, all is correct
What could be wrong? Thanks!
Update
I have found the same problem and solution, but there is used a Azure CLI: https://anthonychu.ca/post/blazor-azure-storage-static-websites/
Upvotes: 0
Views: 4271
Reputation: 194
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 =>
{
subdirApp.UseBlazor<Startup>();
});
I wrote this code in Server.Startup
.
In UseBlazor i have written Client.Startup
.
Upvotes: 4