.Net WCF Web Service Can't Connect from Client to Remote server - c#

I have a client that connects to a WCF web server using NetTCPBinding. I have having issues connecting to the WCF remotely from certain machines.
I can run this client from my other computer to the remote web service however I have a new machine and I cannot connect to the WCF service while running the same client from this machine and I can't figure out why since I have not changed anything in the clients on both machines, they are exactly the same.
I get the error
"The socket connection was aborted. This could be caused by an error processing your message or a receive timeout being exceeded by the remote host, or an underlying network resource issue."
So my question is,
Is there anything on a system level that could be blocking my client from making the connection to the service?
Thanks

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

What do I need to configure in azure so that I can connect to a database located on another server and accessible only through a vpn?

I have an API that is implemented through the WCF service. This application has a database that is only available through a VPN connection. I tried to deploy this application on azure, however, when sending a request to some endpoint, I get a 502 error. I think this is due to the fact that my server is not connected to a VPN.
What do I need to configure on azure to connect to an existing VPN, or how can I solve this problem in another way?
502 Error Is an error code generated when no response is received from the server.
According to your description, the server is not connected through VPN and the application needs to connect to VPN to access, which should be the problem you said. The link below is for a tutorial on setting up a VPN: https://www.rebeladmin.com/2016/12/step-step-guide-configure-site-site-vpn-gateway-connection-azure-premises-network/

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.

Unable to talk to self-hosted WCF Service

Summary:
I noticed that one of the remote machines is not able to connect to this self-hosted WCF service.
Message: Error :System.ServiceModel.EndpointNotFoundException: There was no endpoint listening at https://workflowclientservice.mmx.com/WorkflowClientService that could accept the message. This is often caused by an incorrect address or SOAP action.
The other remote machines are able to talk to the self-hosted WCF service.
Background:
I have a windows service called "Dispatcher Service" and this service is self-hosting some WCF services such as "Workflow Log Service", "Alert Service" and "Workflow Client Service"
I have another windows service called "Client Service" that is consuming these self-hosted WCF services. This windows service (Client Service) is installed on different remote machines. The client service installed on the remote machines are able to communicate to this self-hosted WCF service.
What I have already tried:
I have checked the firewalls and i don't see any issues on the client and the host.
In one of the remote machine (that is able to talk to the service), I opened up an ie browser on the machine and I was able to access the service through the website
In the problem remote machine (that is not able to talk to service), I was not able to reach the service at all in the browser.
I am trying to understand why one of the remote machine is not able to talk to this self-hosted service while other remote machines are able to talk to the service. I would like to try some steps to fix the issue.
Does your service expose a metadata endpoint? Have you tried using WcfTestClient to talk to the self-hosted WCF service? I would try this from the same machine as the service to being with

Custom .net TCP server

Created .net custom tcp server and client using tcplistener. Taks is simple to exchange the data. I have Windows server, on which I am able to communicate. Within network also I am able to communicate. When I deploy this same on our web server, public IP is not accepting connections. At client side it throws time out error:
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 .....
Trace route shows request is going there till server and at the end its not showing time out. Server is VM on azure.
Add the endpoint to the Azure configuration:
https://azure.microsoft.com/en-us/documentation/articles/virtual-machines-set-up-endpoints/
Thanks for your help. It was firewall issue. It is resolved but I am clueless about the problem. Firewall ports opened earlier did not worked. so I stopped firewall and I found its working. later on I started and firewall it again worked. strange....fire wall is not updated it seems.
Thanks.
Kishor

Categories

Resources