I have this bit of code in my Home.razor file in my Blazor website:
protected override async Task OnAfterRenderAsync(bool firstRender)
{
if (!firstRender)
return;
Console.WriteLine("Got here");
}
I get the “Got here” output in the console when running it on Localhost but the output doesn’t appear when I push it to the server.
I used dotpeek to look at the dll ‘projectServer.Client.dll’ and I see that the code is there. It’s just not executing it for some reason when it’s deployed to production.
My render mode is InteractiveAuto: <HeadOutlet @rendermode="@InteractiveAuto" />
Can you please tell me what I’m doing wrong?
8
I found the answer here OnAfterRenderAsync working on local but not on the server
Turns out, Cloudflare’s Auto Minify feature messes up blazor.web.js which in turn messes up the website.