The reason for this error is that there is no PostgreSQL service listening at the specified port. Two of the most common reasons are:

1.       The PostgreSQL service is not installed or running. Please check if PostgreSQL is installed and the service is running. To check the service please start Task Manager (press the Ctrl+Shift+Esc keys simultaneously), go to the services tab and verify that the service is running (see screenshot below). If it is not started use the popup menu to start it.


2.       You’ve provided the wrong port (the service is running but is listening to a different port). To check this you can go to the PostgreSQL installation folder (e.g. C:/Program Files (x86)/PostgreSQL/9.6/data/postgresql.conf), open the postgresql.conf file, and search for “port”. It should match the one you are providing to the database deployment script.