Trying to host Django 4 app with PostgreSQL database on Windows Server 2016 with IIS manager 10 and httpPlatformHandler 1.2.
The app and database work without issues when running on a VM server with python manage.py runserver
in cmd. The problem comes when trying to access with IIS, the Log file shows:
psycopg.OperationalError: connection failed: :1), port 23825 failed: could not receive data from server: Socket is not connected (0x00002749/10057)
could not send SSL negotiation packet: Socket is not connected (0x00002749/10057)
and after I changed DB address from localhost ot 127.0.0.1 the error changed to
File "C:\Users\Administrator\AppData\Local\Programs\Python\Python311\Lib\site-packages\psycopg\connection.py", line 729, in connect
raise ex.with_traceback(None)
django.db.utils.OperationalError: connection failed: could not receive data from server: Socket is not connected (0x00002749/10057)
could not send SSL negotiation packet: Socket is not connected (0x00002749/10057)
and sometimes
psycopg.OperationalError: connection failed: could not receive data from server: Socket is not connected (0x00002749/10057)
could not send SSL negotiation packet: Socket is not connected (0x00002749/10057)
I think there is some option in IIS that prevents establishing a connection.