-
Notifications
You must be signed in to change notification settings - Fork 10.4k
Description
I'm having an issue getting server-side rendering to work with the latest Blazor (3.0.0-preview4-19216-03).
I created a basic ASP.NET Core Web Application using the "Blazor (ASP.NET Core Hosted)" template and build and run. It works correctly.
FIRST BUG: I expect the application created by this template to be already configured to run as a Blazor Server-Side application, since that's what the template leads me to believe it is. Instead it's running as a Blazor Client-Side app. This is confusing.
I then followed the directions here (https://docs.microsoft.com/en-us/aspnet/core/blazor/hosting-models?view=aspnetcore-3.0), in the "Hosting models" section, to make it run server side, but the directions appear out of date.
SECOND BUG: The directions on that link tell me to add in services.AddServerSideBlazor<App.Startup>();
. That function doesn't exist with a type parameter. Only as services.AddServerSideBlazor();
It also tells me to add app.UseServerSideBlazor<App.Startup>();
but this function doesn't appear to exist at all anymore.
Additionally I changed the javascript reference from blazor.webassembly.js to blazor.server.js.
If I leave out the call to app.UseServerSizeBlazor()
(since it doesn't exist) and try to run my application I get a javascript error on an xhr call to "negotiate" in the blazor.server.js file. The error message is:
InvalidOperationException: The SPA default page middleware could not return the default page '/index.html' because it was not found, and no other middleware handled the request.
It's likely that the error message is because of the missing function call, but I don't know that for certain.
I'm testing this in latest Chrome, and I just installed all of the Blazor and .NET Core 3 tooling/extensions/libraries yesterday (4/24/2019).
What am I missing to make the server-side rendering work correctly?