【发布时间】:2021-09-05 13:41:30
【问题描述】:
我有一个 Blazor 页面,当我通过 URL 链接和菜单导航到它时可以正常工作。但是,一旦进入页面,如果我点击 Chrome Refresh 按钮,我会得到一长串 404 错误列表,其中包含我所包含的所有 CSS 和 JS 文件。如果我输入 URL 以直接转到该页面,也会发生这种情况。 Index.razor 页面加载正常。 A-tags 和 NavigationManagers 也可以按预期工作。 URL 是“https://localhost:5001/OrderEdit/223821”,其中 OrderEdit 是页面名称,后跟订单号。页面指令如下所示
@page "/OrderEdit"
@page "/OrderEdit/{OrderNumStr}"
当我刷新页面时,我得到了这个(为简洁起见)
GET https://localhost:5001/OrderEdit/bootstrap/css/bootstrap.min.css?v=1 net::ERR_ABORTED 404
GET https://localhost:5001/OrderEdit/css/Chart.min.css net::ERR_ABORTED 404
GET https://localhost:5001/OrderEdit/css/app.css net::ERR_ABORTED 404
GET https://localhost:5001/OrderEdit/css/site.css net::ERR_ABORTED 404
GET https://localhost:5001/OrderEdit/bootstrap/css/custom.css?v=1 net::ERR_ABORTED 404
GET https://localhost:5001/OrderEdit/_content/Blazorise/blazorise.css net::ERR_ABORTED 404
GET https://localhost:5001/OrderEdit/_content/Blazorise.Bootstrap/blazorise.bootstrap.css net::ERR_ABORTED 404
GET https://localhost:5001/OrderEdit/_content/AntDesign/css/ant-design-blazor.css net::ERR_ABORTED 404
GET https://localhost:5001/OrderEdit/_content/Blazored.Typeahead/blazored-typeahead.css net::ERR_ABORTED 404
GET https://localhost:5001/OrderEdit/_content/BlazorDateRangePicker/daterangepicker.min.css net::ERR_ABORTED 404
GET https://localhost:5001/OrderEdit/_content/Sotsera.Blazor.Toaster/toastr.min.css net::ERR_ABORTED 404
GET https://localhost:5001/OrderEdit/_framework/blazor.webassembly.js net::ERR_ABORTED 404
【问题讨论】:
-
您的 index.html 的
head中有<base href="/" />吗?看起来不是 - 因为它正在尝试从/OrderEdit获取静态文件 -
您是否从“应用程序”选项卡(或 FF 中的存储)中清除了 localhost:5001 的浏览器存储空间?
-
不错!感谢 Magoo 先生,
做到了。
标签: blazor webassembly blazor-webassembly