Blazor Server - the circuit failed to initialize - asp.net

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:
in _Host.cshtml replaced the base tag with <base href="/BlazorApp1/" >
in Startup.cs added app.UsePathBase("/BlazorApp1")
in 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.

The problem was resolved by using only lowercase characters in the <base> tag:
<base href="/blazorapp1/" >

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.

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.

Related

Blazor server showing 'Invocation canceled due to the underlying connection being closed'

We have a Blazor server side webapp with signalr hosted on IIS. We added EventListener for Blazor.start() with reconnectionHandler and reconnectionOptions. When opening the site as part of previous tabs or turning on after a long sleep, the website shows the "An error has occurred. This application may no longer respond until reloaded." error and the console error shows
Error: The list of component records is not valid.
Uncaught (in promise) Error: Invocation canceled due to the underlying connection being closed.
at e.connectionClosed (blazor.server.js:1:27242)
at e.connection.onclose (blazor.server.js:1:17377)
at e.stopConnection (blazor.server.js:1:61423)
at e.transport.onclose (blazor.server.js:1:59077)
at e.close (blazor.server.js:1:47811)
at e.stop (blazor.server.js:1:47400)
at e.<anonymous> (blazor.server.js:1:52950)
at blazor.server.js:1:49394
at Object.next (blazor.server.js:1:49499)
at a (blazor.server.js:1:48266)
There is no load balancing and websockets are enabled in IIS. I checked around on Blazor github and some of the solutions suggested solutions was to add a no-cache meta tag in _Host.cshtml like
<meta http-equiv="Cache-Control" content="no-store" />
Even after adding this, we still get the above errors. Are we missing anything on our end? Any help would be appreciated.
The error does not occur when normally using the application. The signalr works fine.
I had this exact same issue before and found this on github detailing the same issue
As mentioned by Steve, put the following inside the body tag on _Host.chtml instead of putting it as a meta tag.
#{
Response.Headers["Cache-Control"] = "no-store";
}

SignalR negotiate fails (Bad Gateway)

Someone any idea, I’ve been struggling with this for some time.
I'm using SignalR (Asp.net 5). when I try to debug local (ISS 10.0 express) everything is working fine. SignalR is working (Long poll).
Now when I publish the app to Azure it I can access : .azurewebsites.net/signalr/hubs
but I cannot access .azurewebsites.net/signalr/hubs/negotiate
it returns:
The specified CGI application encountered an error and the server terminated the process.
When my web app calls $.connection.hub.start() it will fail.
GET XHR http://xxxx.azurewebsites.net/signalr/negotiate [HTTP/1.1 502 Bad Gateway]
I’m running out of idea's. Don't know how I can get more debug information.
Small selection of my ‘already tried’ list:
Set $.connection.hub.url path manual to http://xxxx.azurewebsites.net/signalr/
Enable/Disable websockets
Removed forwardWindowsAuthToken from the web.config httpPlatform
EDIT:
Now getting more details on this error:
CryptographicException: The data protection operation was unsuccessful. This may have been caused by not having the user profile loaded for the current thread's user context, which may be the case when the thread is impersonating.
Still absolutely no idea how to solve this!
Solved by using appBuilder.UseAesDataProtectorProvider();
(from Owin.Security.AesDataProtectorProvider;)
I have no idea if this is the best solution.

Fatal error encountered in 2XDasm. Exception information is Object reference not set to an instance of an object

I've been doing some changes to a BizTalk application lately, all has been going well, I moved it from development to the Test environment and the application I was working on still works nicely.
The problem is, suddenly an existing application, whenever it receives an HL7 message gets the following error:
Fatal error encountered in 2XDasm. Exception information is Object reference not set to an instance of an object.
Followed by:
There was a failure executing the receive pipeline: "BTAHL72XPipelines.BTAHL72XReceivePipeline, BTAHL72XPipelines, Version=1.3.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35" Source: "BTAHL7 2.X Disassembler" Receive Port: "RP.MyPort.HL7v2.ORU" URI: "0.0.0.0:11001" Reason: Object reference not set to an instance of an object.
Followed again by:
A message received by adapter "MLLP" on receive location "RPL.MyLocation.HL7v2.ORU.MLLP" with URI "0.0.0.0:11001" is suspended.
Error details: There was a failure executing the receive pipeline: "BTAHL72XPipelines.BTAHL72XReceivePipeline, BTAHL72XPipelines, Version=1.3.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35" Source: "BTAHL7 2.X Disassembler" Receive Port: "RP.MyPort.HL7v2.ORU" URI: "0.0.0.0:11001" Reason: Object reference not set to an instance of an object.
MessageId: {7B940750-046A-4E63-9268-EF76F6458CFE}
InstanceID: {5FC204B1-69DE-433E-B90B-AB1E9F77B3B7}
The only difference between these two applications is that the one that works is using a custom Pipeline component whereas the one that is erroring is using the default BizTalk BTAHL72XReceivePipeline (as you can probably see by the error.)
Has anyone experience this? I've seen a couple posts on random sites with people having the error, but nothing that relates to mine.
Well I found the answer. Very bittersweet.
At some point I must have been messing with the EncodingCharset on my receive location in development. I didn't touch that location for months, then when I moved to test, I copied over the bindings and as well as the bad EncodingCharset.
It turned out that I had an empty EncodingCharset in the BTAHL72xReceivePipeline configuration. As soon as I set to ",0" then things worked again.
Here's an image to what I'm talking about.

'Try it now' in the Quick Start never returns

I have installed the API Mgr 1.7.0 in Win 7 64. I have been through the Quick Start guide and all appeared to work as described. However, when I get to the point of trying the subscribed-to cdyne api, the 'moving dots' graphic stays there forever. I can't find a way to stop it, other than a browser refresh. I can't see an entry in the API Mgr system logs.
I have removed the parameters and the auth info, which is supposed to return a 401, but it doesn't and the moving dots continue. I'm using Firefox 31, with AdBlock+ and Noscript. There are no blocked scripts as far as I can see.
[edit 1] I get the same problem with the first sample (YouTube). I wonder if the problem is caused by port values? As I have the ESB installed, I increased all the ports for API Mgr by 1. Maybe I missed one, or there is one that hasn't been documented.[/edit 1]
[edit 2] I have reinstalled the API Mgr. I stopped the ESB and left the APIM ports as default. I have recreated the Phone Verify service and I still have same problem with 'Try it now'. I set the global log level to DEBUG, but there is too much detail to be of use. I don't know what package names to set for this problem.
There was an entry in the Application Logs as follows, which might be relevant. The first few lines are shown:
System Error Occurred
Exception occurred while trying to invoke service method getApplicationNames
The following error details are available. Please refer logs for more details.
org.apache.axis2.AxisFault: Exception occurred while trying to invoke service method getApplicationNames
at org.apache.axis2.util.Utils.getInboundFaultFromMessageContext(Utils.java:531)
at org.apache.axis2.description.OutInAxisOperationClient.handleResponse(OutInAxisOperation.java:370)
at org.apache.axis2.description.OutInAxisOperationClient.send(OutInAxisOperation.java:445)
at org.apache.axis2.description.OutInAxisOperationClient.executeImpl(OutInAxisOperation.java:225)
at org.apache.axis2.client.OperationClient.execute(OperationClient.java:149)
at org.wso2.carbon.logging.view.stub.LogViewerStub.getApplicationNames(LogViewerStub.java:3700)
at org.wso2.carbon.logging.view.ui.LogViewerClient.getApplicationNames(LogViewerClient.java:165)
[/edit 2]
Regards, John
You may not have configured CORS. CORS is cross-origin resource sharing [1] and it is used by the try-it feature in the store.
The CORS configuration is stored in [API Manager Home]/reposotiry/conf/api-manager.xml . The header must include the Host name used by the CORS request. The host name being used by the try-it service is shown in gray at the bottom-left hand corner of the API-Console / try-it screen. It should show up as 'base url'. For example: [ base url: http://10.212.0.846.:8281 , api version: 1.0 ]
You may also be having trouble with the default APIs - please make sure that the APIs in [API Manager Home]/repository/deployment/server/synapse-configs/default/api/ are updated with your port offset. This may be preventing basic authentication. It is documented here [2]
Hope that helps.
-Colin
[1] http://en.wikipedia.org/wiki/Cross-origin_resource_sharing
[2] https://docs.wso2.com/display/AM170/Changing+the+Default+Ports+with+Offset

reCaptcha validation with timeout exception

I am using reCaptch in my MVC 3 web app running in the localhost.
Things were working fine few weeks back but suddenly failing.
Suddenly getting this error.
if(!ReCaptcha.Validate(_config.RecaptchaPrivateKey)){ <-- times out here
//process other fields in the form
}
As soon as I fill the form and hot submit I get this error :
The operation has timed out
Description : An unhandled exception occurred during the execution of the current ...
Exception Details : System.Net.WebException: The operation has timed out
Is this a proxy issue?
Is this because my site on localhost runs on port 3316?
localhost:3316/user/signup
I saw some posts that suggests that reCAPTCHA expects port 80 but my app runs on port 3316
What can be the issue?
Thanks
I got around this by creating proxy class that inherits IWebProxy.
Then specifying to use this proxy when internal, I had to transform it out for other environments that didn't need to use it.
See this question and accepted answer:
Is it possible to specify proxy credentials in your web.config?
The above link took some finding, so I favourited it for future use.

Resources