I am lost. I have localhost database (PostgreSQL) and I have to add port for connection (in app.config — connection string). I alredy tried:
localhost:port
localhost,port
(localhost),port
(local),port
None of this work, everytime I got error “The requested name is valid, but no data of the requested type was found” thrown by System.Net.Dns.InternalGetHostByName with message “cannot open connection”.
So how do you specify the port? I checked this on computer with just single instance of DB server, so port could be ommitted and then it works. But I need adding port.
Update
<add key="ConnectionString" value="Server=localhost;
Port=5434;
Database=XXXXXXX;Initial Catalog=XXXXXXXXX;
UserID=XXXXX;Password=XXXXX;Encoding=UNICODE;" />
Now it works with both “localhost” and “127.0.0.1” (direct IP).
Use a separate keyword for the port: