1

I have a .NET application on a client that connects to a PostgreSQL database using Npgsql library. The issue the client is having is that when trying to establish the connection from the client to the database, an error is thrown in the database log and a timeout error is displayed by the application:

08006: could not receive data from client: An existing connection was forcibly closed by the remote host.

This only happens if the computer is attached to a network. If no network is available, everything works fine.

Computer runs on Windows 7 32 bits

PostgreSQl version is 10.5 32 bits

Npgsql version 3.1.10

Connection is made using client certificates on port 5439

Any other test made in computers with the same characteristics (same Windows version, same RAM amount) do not throw any error and works with or without net connection.

Any suggestions?

Thank you very much.

Edit: Both Database and client are installed on the same computer and Windows Firewall is enabled and configured to allow 5439 traffic. Anyway, if Firewall is disabled the error is still there.

UPDATE:

I have noticed several CAPI2 errors on the Windows event viewer stating

A certificate chain processed, but terminated in a root certificate which is not trusted by the trust provider.

Certificates used to connect to the database are self signed, and created on intallation time with a validity period of 10 years. They are not validated against any external provider or anything.

1
  • You should look at your firewall settings. You should mention in your question if the client and database are on the same computer/same network or the database is being hosted in another network. Include more details so we can help you more. Commented Apr 17, 2020 at 10:36

1 Answer 1

1

Finally found the cuase of the error. Windows did not trust the certificates due a lack of SHA2 support. Installed SHA2 support on Windows (KB4474419 and KB4490628) and everything worked again as it should.

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.