-1

I'm trying to connect IIS which is running on a server in the DMZ to a SQL Server instance on the company intranet. But, I'm getting the following error:

An unhandled exception occurred while processing the request.
Win32Exception: Access is denied.
Unknown location

SqlException: A network-related or instance-specific error occurred while establishing a 
connection to SQL Server. The server was not found or was not accessible. Verify that the 
instance name is correct and that SQL Server is configured to allow remote connections. 
(provider: Named Pipes Provider, error: 40 - Could not open a connection to SQL Server)

Do I need specific ports opened up on one of the servers? Or is there something else I need to do?

Dan
  • 487
  • 5
  • 19
  • Stackoverflow is about programming. This question is probably more suitable for dba.stackexchange.com or networking site – Squirrel Jun 23 '21 at 06:44

1 Answers1

0

Considering your SQL server is running, start with the networking. On which port is your SQL instance listening (default 1433)?

If you don't know, open the SQL Server Configuration Manager (on the SQL Server). Navigate to the SQL Server Network Configuration > Protocols for %instancename% > TCP/IP > IP Addresses. Then, test if something is blocking this connection; on your IIS in PowerShell:

Test-NetConnection -ComputerName sqlservername -Port 1433

If this doesn't work, check the Inbound Rules for Windows Firewall on your SQL Server. Make sure you work on the right network profile and eventually speak to the one managing your network systems in your company.

Maybe your IIS can't resolve the SQL Servers hostname? Try using the IP and check your DNS configuration.

There might also be something off with your connection string. Mind posting it here?

Jeremy Caney
  • 7,102
  • 69
  • 48
  • 77
Manu
  • 151
  • 7
  • Thanks. Looks like ping succeeded but TCP test failed: PingSucceeded : True PingReplyDetails (RTT) : 13 ms TcpTestSucceeded : False – Dan Jun 23 '21 at 14:57
  • 1
    It seems every server/port connection from/to the DMZ needs to be requested to be opened. – Dan Jun 23 '21 at 17:19