I’m using Ubuntu 18.04 with pre-installed docker solution.
My project setup is that I run my Asp.Net Core 3.1 Web Api with EntityFramework Core project in a docker container and I install Nginx on the server directly. My Web Api is connected to a Managed PostgreSQL database on DO as well using the connection string provided.

This is my Nginx configuration for the application:

server {

    server_name example.com www.example.com;

    location / {
        proxy_pass http://localhost:5000;
        proxy_http_version 1.1;
        proxy_set_header Upgrade $http_upgrade;
        proxy_set_header Connection keep-alive;
        proxy_set_header Host $host;
        proxy_cache_bypass $http_upgrade;
        proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
        proxy_set_header X-Forwarded-Proto $scheme;

    listen [::]:443 ssl ipv6only=on; # managed by Certbot
    listen 443 ssl; # managed by Certbot
    ssl_certificate /etc/letsencrypt/live/example.com/fullchain.pem; # managed by Certbot
    ssl_certificate_key /etc/letsencrypt/live/example.com/privkey.pem; # managed by Certbot
    include /etc/letsencrypt/options-ssl-nginx.conf; # managed by Certbot
    ssl_dhparam /etc/letsencrypt/ssl-dhparams.pem; # managed by Certbot


server {
    if ($host = www.example.com) {
        return 301 https://$host$request_uri;
   } # managed by Certbot

   if ($host = example.com) {
       return 301 https://$host$request_uri;
   } # managed by Certbot

        listen 80;
        listen [::]:80;

        server_name example.com www.example.com;
    return 404; # managed by Certbot

Every time I try to call the api to retrieve data from the managed database I get: ‘An exception has been raised that is likely due to a transient failure.’

Please does anyone know why this is happening?

Submit an answer

You can type !ref in this text area to quickly search our full set of tutorials, documentation & marketplace offerings and insert the link!