Asp.net mvc Blazor是用MVC预渲染的。控制器正在附加/[Controller]/。。。到操作路径,不加载_framework/blazor.boot.json

Asp.net mvc Blazor是用MVC预渲染的。控制器正在附加/[Controller]/。。。到操作路径,不加载_framework/blazor.boot.json,asp.net-mvc,.net-core,blazor-webassembly,Asp.net Mvc,.net Core,Blazor Webassembly,我有点酸黄瓜。我不确定我的设置有多标准,所以我将简要介绍一下 我们有一个项目,在这个项目中,我们同时设置了MVC和API服务端点。它工作得很好。我最近读到,您可以使用如下方式将Blazor组件混合到MVC项目中: @(await Html.RenderComponentAsync<BlazorComponents.Components.SelectExmpleComponent>(RenderMode.WebAssemblyPrerendered, new {Options = op

我有点酸黄瓜。我不确定我的设置有多标准,所以我将简要介绍一下

我们有一个项目,在这个项目中,我们同时设置了MVC和API服务端点。它工作得很好。我最近读到,您可以使用如下方式将Blazor组件混合到MVC项目中:

@(await Html.RenderComponentAsync<BlazorComponents.Components.SelectExmpleComponent>(RenderMode.WebAssemblyPrerendered, new {Options = operatorRoles}))
<script src="@Url.Content("~/_framework/blazor.webassembly.js")"></script>
// This method gets called by the runtime. Use this method to configure the HTTP request pipeline.
    public void Configure(IApplicationBuilder app, IWebHostEnvironment env)
    {
        if (env.IsDevelopment())
        {
            app.UseDeveloperExceptionPage();
            app.UseWebAssemblyDebugging();
        }
        else
        {
            app.UseExceptionHandler("/Error");
            // The default HSTS value is 30 days. You may want to change this for production scenarios, see https://aka.ms/aspnetcore-hsts.
            app.UseHsts();
        }

        app.UseSession();
        app.UseHttpsRedirection();
        app.UseStaticFiles();
        app.UseBlazorFrameworkFiles();

        app.UseRouting();

        app.UseAuthorization();
        app.UseAuthentication();
        
        app.UseEndpoints(endpoints =>
        {
            endpoints.MapRazorPages();
            endpoints.MapControllers();
            endpoints.MapControllerRoute(
                name: "default",
                pattern: "{controller=Home}/{action=Index}");
        });
    }