Reputation: 177
I have published the BlazorApp1 app created by the VS2019 Blazor template to a production server. Since it is a sub-site, I made 3 changes:
_Host.cshtml
replaced the base tag with <base href="/BlazorApp1/" >
Startup.cs
added app.UsePathBase("/BlazorApp1")
web.config
, changed the hostingModel
to outofprocess
and stdoutLogEnabled
to true
When navigating to the site I almost always get the following error:
Unhandled Exception Page must be reloaded
This is displayed in the browser console: (replaced my site with contoso)
[2020-06-02T18:39:49.445Z] Information: Normalizing '_blazor' to 'http://www.contoso.com/BlazorApp1/_blazor'. blazor.server.js:1:5212
[2020-06-02T18:39:49.936Z] Information: WebSocket connected to ws://www.contoso.com/BlazorApp1/_blazor?id=5yq6pI_jo1ByPZtskEjjmw. blazor.server.js:1:5212
[2020-06-02T18:39:50.132Z] Error: The circuit failed to initialize. blazor.server.js:15:27309
log http://www.contoso.com/BlazorApp1/_framework/blazor.server.js:15
C http://www.contoso.com/BlazorApp1/_framework/blazor.server.js:8
S http://www.contoso.com/BlazorApp1/_framework/blazor.server.js:8
invokeClientMethod http://www.contoso.com/BlazorApp1/_framework/blazor.server.js:1
invokeClientMethod .../BlazorApp1/_framework/blazor.server.js:1
processIncomingData .../BlazorApp1/_framework/blazor.server.js:1
onreceive .../BlazorApp1/_framework/blazor.server.js:1
onmessage .../BlazorApp1/_framework/blazor.server.js:1
[2020-06-02T18:39:50.141Z] Information: Connection disconnected. blazor.server.js:1:5212
Error: Invocation canceled due to the underlying connection being closed. blazor.server.js:1:20001
I can't find any other clues about what's happening. There are no exceptions shown in the log.
Upvotes: 5
Views: 6530
Reputation: 1
simply, install Microsoft.AspNetCore.SignalR.Client and configure signalr correctly
Upvotes: -2
Reputation: 908
For me it happened because I put an async call inside a constructor of a class in DI, so, yeah, that's a stupid error which can mean anything.
Upvotes: 2
Reputation: 3697
It has just happened to me as well, but I had the base
tag specified correctly. This error can also occur in a rare case when you have ambiguous constructors defined for one of your dependency injected services if both match all the parameters (possibly by accident due to inheritance). The verbose log won't point to that issue. Be aware that purposeful creation of multiple constructors for dependency injected services is considered an anti-pattern.
Upvotes: 0
Reputation: 177
The problem was resolved by using only lowercase characters in the <base>
tag:
<base href="/blazorapp1/" >
Upvotes: 7