I have a server side Blazor Application with Authentication setup as suggested in the Visual Studio Tempalte. I then added the identity scaffolding items. No I try to a razor component to the login screen, so that I can keep everything in the same design.
On the page itself I added this:
<script src="~/_framework/blazor.server.js"></script>
<Login>
@(await Html.RenderComponentAsync<ApplySupportTool.Blazor.Pages.Shared.Login>(RenderMode.Server))
</Login>
Now since the Identity Pages run in their own processes (based on the ScaffoldingReadme) which is setup in the IdentityHostingStartup.cs I tried to add the Blazor Setup things there:
builder.ConfigureServices((context, services) => {
});
builder.UseStartup<IdentityStartup>();
public class IdentityStartup
{
public void ConfigureServices(IServiceCollection services)
{
services.AddServerSideBlazor();
}
public void Configure(IApplicationBuilder app)
{
app.UseRouting();
app.UseEndpoints(endpoints =>
{
endpoints.MapBlazorHub();
});
}
}
But as soon as I do that, I get an Null Pointer Exception when I try to resolve my DB Context in the programm.cs. Interesstingly this happens as well when I have just the empty method bodies in the IdentityStartup. Also I tried to move all DB initialization code into the startup to avoid the null pointer, but then the site just won't start. Do I have to set this up differently or somewhere else?