SignalR can't connect to hub when using Azure Service Bus backplane - c#

I downloaded the SignalR Getting Started solution and it works well. However if I add Azure Service Bus backplane then the client can't connect any more.
First it tries to connect to WebSocket
SCRIPT12030: WebSocket Error: Network Error 12030, The connection with the server was terminated abnormally
Then falls back to long polling and it doesn't work either.
SCRIPT7002: XMLHttpRequest: Network Error 0x2eff, Could not complete the operation due to error 00002eff.
Running it locally, debugging and there is no exception thrown on the server side.
The only difference between the working and non-working status is in the Startup.cs if I comment out the UseServiceBus part then it works:
//GlobalHost.DependencyResolver.UseServiceBus(connectionString, "Blabla");
app.MapSignalR();
Obviously I can't leave it like this for Azure deployment.
I tried upgrading / downgrading packages, both SignalR and WindowsAzure.ServiceBus, all the same.
Any ideas?

I have the same error, i have seen that the response for https://localhost/signalr/connect?transport=webSockets.... is 400 the problem is that my service bus Pricing plan is basic but only Standard tire to support Topics. So you have to go to azure portal and under the "Pricing tire" section of service bus you have to specifically go to the settings and scaled it up from Basic to Standard.

Related

How do I determine what's resetting my connection?

I have a client and server, based on TcpListener and TcpClient. The client connects to the server and they exchange some data. Everything works just fine when I run locally.
But when I put the server in a Docker container on Azure Container Services, and connect the client to it, the following happens:
Client connects successfully to server
Client and server perform successful handshake
Data transfer begins
Approximately 20 seconds later (this is supposed to take several minutes) the whole thing blows up. The server reports "connection reset by peer" and the client reports "error reading past the end of the stream."
Each side seems to think the other side is the one with the problem. When I'm running locally, everything works as expected, which leads me to believe that the problem is somewhere in between.
There isn't a fundamental issue with establishing the connection, such as a firewall getting in the way, because I've verified at both ends that they're connecting and performing the handshake. The client is not "slamming the phone down"; it's expecting more data from the server. But "connection reset by peer" means that someone somewhere is intentionally sending a RST packet.
Is there any good way to figure out what's interfering with my data transfer?
For Azure Container Services (be it Azure Container Instances or Azure Kubernetes Service), the major cause for intermittent connection issues is hitting a limit while making new outbound connections. The limits you can hit include:
TCP Connections
SNAT ports
Please see:
Detecting SNAT port exhaustion on Azure Kubernetes Service
Troubleshooting intermittent outbound connection errors in Azure App Service (even if it is about Azure App Service most of them still apply)
More info:
kube-proxy Subtleties: Debugging an Intermittent Connection Reset
Fix a random network Connection Reset issue in Docker/Kubernetes

How to connect to remote gRPC service

I created a gRPC service and client in C# .NET Core 3.1. When I deploy the service to localhost, I can connect to it without a problem. But when I publish the service to a IIS via WebDeploy and start it there I cannot connect to it.
For a local deployment, the channel is initialized as follows:
var channel = GrpcChannel.ForAddress("https://localhost:5001");
For the remote deployment I change it to the following value, since it starts as a HTTP service on http://localhost:5000 on the remote machine (which I also failed to find out how to change - I would prefer it to start as a HTTPS service):
AppContext.SetSwitch("System.Net.Http.SocketsHttpHandler.Http2UnencryptedSupport", true);
var channel = GrpcChannel.ForAddress("http://1.2.3.4:5000");
1.2.3.4 is the IP of the remote machine, which I am able to ping. I also created a firewall rule to allow all inbound traffic on inbound port 5000.
The client application fails on the first remote call with the error message
A connection attempt failed because the connected party did not properly respond after a period of time, or established connection failed because connected host has failed to respond
I fail to understand which measures I have to take to create a connection to the remote service. All example gRPC code I have found so far uses localhost as a deploy point and did not help me figure out the root cause of my problem.
Any help or pointers towards what I must have missed are appreciated.
From Tutorial: Create a gRPC client and server in ASP.NET Core, a warning almost at the end of the article, says
ASP.NET Core gRPC is not currently supported on Azure App Service or IIS. The HTTP/2 implementation of Http.Sys does not support HTTP response trailing headers which gRPC relies on...
Please refer to gRPC in production for ways to run your gRPC service in production.

Azure function c# .net throws 502

I am having consumption plan in azure, do not have any gateway or proxy setup.
While testing I got this error also its not logging in my app insights, it neglects that request, as like it did not reached/requested to it.
How can fix this ?
502 - Web server received an invalid response while acting as a gateway or proxy server
Cause:
This problem is often caused by application level issues, such as:
1.requests taking a long time
2.application using high memory/CPU
3.application crashing due to an exception.
Steps:
1.Observe and monitor application behavior
2.Collect data
3.Mitigate the issue
Have a look of this Offcial doc.

MQ Error Reason: 2058 randomly starts occurring in C# .NET client after working correctly for multiple days

Client Details: The issues occurs with code acting as a producer pushing messages into IBM MQ queues and topics. The producer is exposed as a REST interface using WebApi2 and is deployed on IIS. We are using C# .NET (4.5.2) client to connect to IBM MQ. We connect using the CCDT file AMQCLCHL.TAB to get the client connection details. The underlying libraries used are Apache NMS (1.8.0.4573) and IBM XMS (2.5.0.3).
Exception Received: CWSMQ0006E: An exception was received during the call to the method ConnectionFactory.CreateConnection: CompCode: 2, Reason: 2058.
Error Details: The client correctly works and we are able to push hundred thousands messages through to MQ queues and topics. However, after a random period of time ranging from few hours to more than 1 week, the client starts failing with the error noted above. Few more details:
The error is resolved by restarting the IIS pool or reloading the application
Connecting to the same MQ server from another client (IIS server 2) continues to work when first client (IIS server 1) continues to have issues
Error seen in AMQERR01.LOG file.
AMQ9516: File error occurred.
EXPLANATION: The filesystem returned error code 6 for file'\\...\AMQCLCHL.TAB'.
ACTION: Record the name of the file '\\...\AMQCLCHL.TAB' and tell the systems administrator, who should ensure that file '\\...\AMQCLCHL.TAB' is correct and available.
Error code 6 is ERROR_INVALID_HANDLE.
This happens when the connection was closed (could be remote server restart, network issues, etc...). This really takes me back - I remember dealing with this back in 2002 connecting a Java J2EE application to MQ on an OS/390.
Recently IBM has implemented auto reconnect settings that can be set in the CCDT or manually on the C# object. This is summarized on the XMS page, and the documentation for implementing that is here.
The properties Client Reconnect Options, Client Reconnect Timeout, and Connection Namelist can also be set via Client Channel Definitions Table (CCDT) or by enabling the client reconnection via the mqclient.ini file.
Based on suggestions from #JoshMc, we noticed intermittent errors related to accessing the AMQCLCHL.TAB file on the NAS in the AMQERR01.LOG file. This seemed to mess up the unmanaged client at our end which could only be fixed with an IIS restart. Our setup was updated to move this file to local disk on the server and then point our code to it. This resolved the issue and we have been going strong without issues for the last two weeks since this change was made.

SignalR 2.2.0 WebSocket error connecting to hub

I have an ASP.Net MVC application that I have added SignalR to. After following the "Getting Started" tutorial (with modifications of course since it's going in my application) I got it working on localhost. However once it's in the production environment, I get the following error:
WebSocket connection to 'ws://xxxxx/signalr/connect?transport=webSockets&clientProtocol=1.5&connectionToken=xxxxx' failed: Connection closed before receiving a handshake response.
I can access /signalr/hubs (I get a js file). Any ideas as to why this would happen?
This may be due to the fact that your web server doesn't support WebSockets (IIS 7.5, for instance. It may also be due to the fact that you are using a "proxy" server like ARR and it just cannot "route" WebSocket requests.
The first thing I would try to do is to disable WebSockets on SignalR, just as a debug tool. Here's how: SignalR - How do I disable WebSockets
If your problem persists, it's a general SignalR problem but at least you will have a more specific error. If the problem stops, now you know it is a server issue.

Categories

Resources