Score:0

dotnet core web application cannot reach remote SQL Server

tm flag

I have a setup with a dotnet core web application. It is deployed in an Azure VM running Ubuntu. The web is served in nginx. This particular web application accesses a number of different databases. One of these connections is not working when the solution is deployed to the VM. Here are some details:

  • The SQL Server does not run on the default port 1433, but instead 15333 - I do not have control of this server, so changing the port is not an option
  • On my developer laptop, the connection string to this SQL Server is working - data extraction works as expected.
  • From the Azure Ubuntu VM I am able to do a telnet to the SQL Server (telnet IP 15333). I get a "Connected to IP" response.
  • Connections to other databases (Oracle, other SQL Server databases (running on 1433)), are working alright in the application.
  • All databases (working and the not-working one) are in the same network domain as my developer laptop.

So I am a bit confused on what the problem is. When connecting to the problematic SQL Server the connection times out after 30 seconds (default). A near immediate response would be expected if things were working as expected.

The nginx configuration looks like this:

user www-data;
worker_processes auto;
pid /run/nginx.pid;
include /etc/nginx/modules-enabled/*.conf;

events {
        worker_connections 768;
        # multi_accept on;
}

http {

        ##
        # Basic Settings
        ##

        sendfile on;

        include /etc/nginx/mime.types;
        default_type application/octet-stream;

        ##
        # Logging Settings
        ##

        access_log /var/log/nginx/access.log;
        error_log /var/log/nginx/error.log;

        ##
        # Virtual Host Configs
        ##

        include /etc/nginx/conf.d/*.conf;

        server {
                listen 80;

                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;
                }
        }
}

Running ufw status gives me:

To                         Action      From
--                         ------      ----
Nginx HTTP                 ALLOW       Anywhere
443/tcp                    ALLOW       Anywhere
80/tcp                     ALLOW       Anywhere
20:21/tcp                  ALLOW       Anywhere
30000:31000/tcp            ALLOW       Anywhere
OpenSSH                    ALLOW       Anywhere
14431/tcp                  ALLOW       Anywhere
14431                      ALLOW       Anywhere
1433                       ALLOW       Anywhere
Nginx HTTP (v6)            ALLOW       Anywhere (v6)
443/tcp (v6)               ALLOW       Anywhere (v6)
80/tcp (v6)                ALLOW       Anywhere (v6)
20:21/tcp (v6)             ALLOW       Anywhere (v6)
30000:31000/tcp (v6)       ALLOW       Anywhere (v6)
OpenSSH (v6)               ALLOW       Anywhere (v6)
14431/tcp (v6)             ALLOW       Anywhere (v6)
14431 (v6)                 ALLOW       Anywhere (v6)
1433 (v6)                  ALLOW       Anywhere (v6)

What could be the issue here? Any hints on how to diagnose the problem would be appreciated.

mangohost

Post an answer

Most people don’t grasp that asking a lot of questions unlocks learning and improves interpersonal bonding. In Alison’s studies, for example, though people could accurately recall how many questions had been asked in their conversations, they didn’t intuit the link between questions and liking. Across four studies, in which participants were engaged in conversations themselves or read transcripts of others’ conversations, people tended not to realize that question asking would influence—or had influenced—the level of amity between the conversationalists.