Skip to main content

Posts

Showing posts from April, 2023

.NET 8 Blazor Server App _Host Routing Internal Server Error

 When firing up a new Blazor Server App with .NET 8 Preview, the following error was occurring.   An unhandled exception occurred while processing the request. InvalidOperationException: Cannot find the fallback endpoint specified by route values: { page: /_Host, area: }. Microsoft.AspNetCore.Mvc.RazorPages.Infrastructure.DynamicPageEndpointMatcherPolicy.ApplyAsync(HttpContext httpContext, CandidateSet candidates) To resolve, the project file can be updated with   References https://github.com/dotnet/aspnetcore/issues/36535#issuecomment-919861308 More info available on UseRazorSourceGenerator at  https://learn.microsoft.com/en-us/aspnet/core/razor-pages/sdk?view=aspnetcore-7.0

Enable .NET 8 Preview in Visual Studio

Download the SDK using Download .NET 8.0 (Linux, macOS, and Windows) (microsoft.com)  and install it. To enable projects to target the .NET 8 preview framework, the preview option in Visual Studio needs to be enabled, otherwise the option to target .NET 8 will not be available as shown below when setting up a new project (or trying to upgrade an existing one). To allow .NET 8 Preview to be used as a target framework for projects, the preview option needs to be enabled in Visual Studio. Open Visual Studio and select "Continue without code" In Visual Studio, select Tools then Options In Options, under Environment, select Preview Features and enable Use previews of the .NET SDK.