[英]Asp.net hosted multiple blazor apps
I dividing my website into multiple blazor apps in which each module should be routed by a sub path eg: products module should be accessed by the url "domain/products" etc.我将我的网站分成多个 blazor 应用程序,其中每个模块都应该通过子路径路由,例如:产品模块应该通过 url“域/产品”等访问。
so in the configure method in my asp.net core server project when calling所以在调用时在我的asp.net核心服务器项目中的configure方法中
app.UseBlazor<Products.Startup>()
whats the proper way to rout all the single page app url through "domain/products/*"通过“域/产品/*”路由所有单页应用程序 url 的正确方法是什么
thanks谢谢
You can host your blazor app in a sub folder with:您可以在子文件夹中托管您的 blazor 应用程序:
app.Map("/subfolder", child => { child.UseBlazor<Blazor.Program>(); });
And change the basepath of your blazor app in the index.html like this:并在 index.html 中更改 blazor 应用程序的基本路径,如下所示:
<base href="/subfolder/" />
If your like me that's looking for this now, this will get you what you need (as far as I can tell)如果你像我一样现在正在寻找这个,这会给你你需要的东西(据我所知)
app.Map("/site1", app =>
{
app.UseRouting();
app.UseAuthorization();
app.UseClientSideBlazorFiles<Site1.Startup>();
app.UseEndpoints(endpoints =>
{
endpoints.MapFallbackToClientSideBlazor<Darixidor.Site.Startup>("index.html");
});
});
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.