简体   繁体   English

Asp.net 托管多个 blazor 应用程序

[英]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.

相关问题 Blazor WASM Asp.net 核心是否托管 = Blazor 服务器端? - Is Blazor WASM Asp.net core Hosted = Blazor server side? 部署托管到 Azure 的 Blazor WebAssembly 应用 ASP.NET Core - Deploy Blazor WebAssembly App ASP.NET Core hosted to Azure ASP.NET Core 托管 Blazor 模板中的授权问题 - Authorization issue in ASP.NET Core hosted Blazor template 如何使用 ASP.NET 核心托管发布 Blazor WebAssembly - How to publish Blazor WebAssembly with ASP.NET Core hosted Blazor,ASP.NET Core 托管与 ASP.NET Core 中的服务器端 - Blazor, ASP.NET Core Hosted vs Server Side in ASP.NET Core Blazor ASP.NET 托管身份验证,使用现有数据库和身份表 - Blazor ASP.NET Hosted Identity Authentication with already existing database with Identity tables 对于托管在 asp.net core 中的 Blazor Wasm,User.Identity.Name 为 null - User.Identity.Name is null for Blazor Wasm hosted in asp.net core 如何使用 ASP.NET Core Hosted 生成 Blazor wasm 脚手架 CRUD (EF) - How to generate Blazor wasm scaffolded CRUD (EF) wiht ASP.NET Core Hosted Blazor Webassembly (PWA) 是否支持独立的 session 存储(不在 asp.net 内核中托管)? - Is session storage supported in Blazor Webassembly (PWA) standalone (Not hosted in asp.net core)? Blazor WebAssembly 应用程序与个人帐户和 ASP.NET 核心托管 - 令牌请求 - “错误”:“unauthorized_client” - Blazor WebAssembly App with Individual Accounts and ASP.NET Core Hosted - Token request - "error": "unauthorized_client"
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM