I have pulled and ran a container for PostgreSQL on my Ubuntu Server using Docker, using the instructions from these instructions.
Using Visual Studio on my Windows 10 workstation, I have developed a Blazor Web Page that connects to the PostgreSQL docker container on my Ubuntu Server using Npgsql, and uses it as the back-end. I eventually used Visual Studio's docker image building capabilities to convert my deployed ASP.NET app to a docker container that I want to run on the same Ubuntu server.
Running the container from Visual studio seems to work fine, I am successfully able to load the web page and I'm able to use the PostgreSQL as my back-end. I am also able to connect to the server without using Visual Studio, by just running the deployed image as a container on my workstation.
I want to have the Blazor web page run from the same Ubuntu Server as my PGSQL docker container, but on different containers, so that I can access the app from any computer on my local network. I pushed the container to my repository on Docker, and then pull it on my Ubuntu Server so that it could run on there.
When I run the Blazor App container on Ubuntu, I keep getting the following exception when loading a page that accesses data from my PGSQL container:
System.InvalidOperationException: An exception has been raised that is likely due to a transient failure.
---> Npgsql.NpgsqlException (0x80004005): Exception while connecting
---> System.TimeoutException: The operation has timed out.
What I've tried:
I am relatively new to Docker and ASP.NET core, and I'm not an IT guy, so any help or ways to troubleshoot this would be very helpful.
EDIT: One more thing I tried: installing the psql client on my docker container and attempting to connect to the PGSQL container using the same parameters as my connection string in my C# program. It wasn't able to connect.
User contributions licensed under CC BY-SA 3.0