【发布时间】:2021-02-28 14:23:41
【问题描述】:
我想创建一个应用,我需要在基域上使用静态页面,在子目录上使用 Blazor 应用。
例子:
https://example.com 是我的静态页面应该在的位置(例如“/features”或“/pricing”或“/faq”)
https://example.com/app 应该是我的 blazor 网站所在的位置。
我看到我可以将PathString 传递给app.UseBlazorFrameworkFiles,但这不起作用(app.UseBlazorFrameworkFiles(new PathString("/app"))。
我的 Blazor 应用托管在使用 gRPC 的 .NET 5 WebApi 项目上。
有人能指出正确的方向吗?
提前致谢!
【问题讨论】:
-
您是否将
<base href="/app/">放入您的Index.html 中? docs.microsoft.com/en-us/aspnet/core/blazor/host-and-deploy/… -
嗨@BrianParker,是的,我做到了。我添加了
<base href="/app/" />' toClient/wwwroot/app/index.html`,其中包含<div id="app">...并加载了blazor.webassembly.js文件。
标签: .net routes blazor static-files blazor-webassembly