0
votes

Using .NET Core with the latest release version of server side Blazor, I implemented Blazor components in an existing MVC application (thanks to Chris https://chrissainty.com/using-blazor-components-in-an-existing-mvc-application/) I can only render the Blazor component on the default page (i.e. https://localhost:5433). The Blazor components works totally fine in the default page but when I try to open the view using https://localhost:5433/home/index or any other view, the Blazor component does not get rendered.

Am I missing something here?

1
Does this answer your question? asp.net mvc url routingBrian Ogden
That doesn't look related to his question at all...?Kyle
I think this documentation might help you out. You might have to set the routes up specifically for the path.KevinLamb
This question needs more information and sample code. Set up a minimal reproducible example.Henk Holterman

1 Answers

1
votes

I figured it out! To answer some of the questions and a reproducible example:

Create an empty MVC Core Application and follow Chrissianity's tutorial on how to implement Blazor to an existing MVC https://chrissainty.com/using-blazor-components-in-an-existing-mvc-application/

I didn't notice that I was using

@(await Html.RenderComponentAsync<CoursesList>(**RenderMode.Server**, 
     new { Courses = Model }))

rather than

@(await Html.RenderComponentAsync<CoursesList(**RenderMode.ServerPrerendered**, 
   new { Courses = Model }))

When I changed my rendermode, the pages now work.