Jannik
Jannik

Reputation: 421

An existing connection was forcibly closed by the remote host in production environment

When calling my servicestack api from one of our production servers, using our web application, I get this exception:

IOException: Unable to read data from the transport connection: An existing connection was forcibly closed by the remote host.

This only happens when I call the service throught my website, using a ServiceStack JsonServiceClient

Here is the code of the service client:

        var client = this.GetJsonServiceClient();

        client.Timeout = TimeSpan.FromMinutes(30);

        var result = client.Post<TotalRedeemsFindResponse>(request);

        return result;

Here is what I have discovered:

  1. If I call the url of the service directly from a browser, on the same server as the website, it returns the correct response
  2. If I call the url of the service from my local machine, it returns the correct response.
  3. If I use my local version of the JsonServiceClient (which is identical to the one in my production environment) it returns the correct response

I'm out of ideas on what to do, to try to fix this issue. Does any of you guys have solutions for me to try?

Thanks

Upvotes: 1

Views: 532

Answers (1)

mythz
mythz

Reputation: 143379

You should first be inspecting your network traffic to see if there's any issues with the HTTP request, e.g. using Fiddler or a packet sniffer like WireShark.

Something else you can try is using a different service client implementation. e.g. If you were using JsonServiceClient try using JsonHttpClient from the ServiceStack.HttpClient NuGet package to see if that makes a difference.

Upvotes: 1

Related Questions