我将我的基本href更改为index.html
:href="/"
已成为href="/schedule/"
我也改变Configure
:
app.UseStaticFiles();
app.UseStaticFiles(new StaticFileOptions()
{
FileProvider = new PhysicalFileProvider(Path.Combine(Directory.GetCurrentDirectory(),@"Schedule.Client", @"dist")),
RequestPath = new PathString("/schedule")
});
这里找到了我的文件
css、js、资源运行良好,但包含 wasm 文件的 _framework 无法正常运行。
索引.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>
当我使用href="/"
时,一切都是正确的
有什么问题?谢谢!
更新
我发现了同样的问题和解决方案,但是使用了 Azure CLI: https ://anthonychu.ca/post/blazor-azure-storage-static-websites/