Question

I am trying to run/debug locally my cloud project, but service bus connection keeps crashing with error:

<15:46:59> MessagingFactory successfully created
<15:47:39> Exception: The underlying connection was closed: An unexpected error occurred on a send.. 

....
   System.IO.IOException: Unable to read data from the transport connection: 
    An existing   connection was forcibly closed by the remote host. ---> System.Net.Sockets.SocketException: An existing connection was forcibly closed by the remote host
   at System.Net.Sockets.Socket.EndReceive(IAsyncResult asyncResult)
   at System.Net.Sockets.NetworkStream.EndRead(IAsyncResult asyncResult)
   --- End of inner exception stack trace ---
   at System.Net.TlsStream.EndWrite(IAsyncResult asyncResult)
   at System.Net.PooledStream.EndWrite(IAsyncResult asyncResult)
   at System.Net.ConnectStream.WriteHeadersCallback(IAsyncResult ar)}

Also I receive this error when using Service Bus Explorer tool.

When deploy to cloud everything works ok, service bus connection is ok.

Can anyone help me with this? what could be the reason? Thank you in advance!

Was it helpful?

Solution 2

There are several reason leading to such error so you may check the following

  • You have configured the settings correctly.
  • Firewall in your system allows the connection (protocol, host & port)
  • DNS servers configured in your network are able to resolve the host.
  • Your ISP is not blocking your connection due to any reason

Since there is no fixed solution for your error, you may have to work a little hard to figure out the actual issue. You may also find some useful information from the log files if enabled.

OTHER TIPS

Maybe the problem is with the SSL certificate validation protocol. Try this to force the latest protocol type.

ServicePointManager.SecurityProtocol = SecurityProtocolType.Tls12;
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top