SQL Server 08 Express error when connecting to localhost - "Timeout expired". Works with ::1 or 127.0.0.1

3

EDIT

New info: Navigating to localhost:1434 in Chrome gives me an "ERR_EMPTY_RESPONSE", while other ports give me an "Oops! This link appears to be broken". So it seems to binding ok there?

So here's my setup so far:

  • I've configured Windows Firewall to allow TCP on 1433 and UDP on 1434.
  • I've set up SQL Server to use any IP on Port 1433 (using the SQL Server Configuration Manager).
  • My hosts file contains the default entries ("127.0.0.1 localhost" and "::1 localhost").
  • I sometimes have a debug session of Visual Web Developer running a webserver, but it's on a specific port (localhost:5XXXX).

What I've tried:

  • I CAN ping localhost in a cmd prompt.
  • I CAN connect to the database through SSMS if I specify 127.0.0.1 or ::1 as the server name.
  • I CAN'T connect to the database through SSMS (or ADO.NET) if I specify localhost as the server name. I've tried both Windows and SQL Authentication The error I get is the standard

Can't connect to localhost. Additional Information --> Timeout expired. The timeout period elapsed prior to completion of the operation or the server is not responding. (Microsoft Sql Server)

Other considerations:

  • Stopping the Visual Web Developer web server from the taskbar doesn't affect the sql problem.
  • The SQL error log says that it's listening on some piped name url at start up (I don't see how this would affect localhost but not 127.0.0.1 though).

I could probably just use 127.0.0.1 everywhere, but it scares me that localhost isn't working and I'd like to figure out why.

I'm not much of a networking or sql server guy so I'm stuck. If you want me to try anything to help diagnose just put it in a comment and I'll give it a go.

Netstat results:

Setting SDK environment relative to C:\Program Files\Microsoft SDKs\Windows\v6.1

Targeting Windows Server 2008 x86 DEBUG

C:\Program Files\Microsoft SDKs\Windows\v6.1>netstat -ano | findstr 1434
  UDP    0.0.0.0:1434           *:*                                    6868
  UDP    [::]:1434              *:*                                    6868

C:\Program Files\Microsoft SDKs\Windows\v6.1>netstat -ano | findstr 1433
  TCP    0.0.0.0:1433           0.0.0.0:0              LISTENING       2268
  TCP    127.0.0.1:1433         127.0.0.1:50758        ESTABLISHED     2268
  TCP    127.0.0.1:50758        127.0.0.1:1433         ESTABLISHED     5008
  TCP    [::]:1433              [::]:0                 LISTENING       2268
  TCP    [::1]:1433             [::1]:51202            ESTABLISHED     2268
  TCP    [::1]:1433             [::1]:51616            ESTABLISHED     2268
  TCP    [::1]:51202            [::1]:1433             ESTABLISHED     5008
  TCP    [::1]:51616            [::1]:1433             ESTABLISHED     5008

C:\Program Files\Microsoft SDKs\Windows\v6.1>

SQL Server Log File:

In case it helps

2010-01-30 12:58:59.01 Server      Microsoft SQL Server 2008 (SP1) - 10.0.2531.0 (Intel X86) 
    Mar 29 2009 10:27:29 
    Copyright (c) 1988-2008 Microsoft Corporation
    Express Edition on Windows NT 6.0  (Build 6002: Service Pack 2)

2010-01-30 12:58:59.01 Server      (c) 2005 Microsoft Corporation.
2010-01-30 12:58:59.01 Server      All rights reserved.
2010-01-30 12:58:59.01 Server      Server process ID is 2268.
2010-01-30 12:58:59.01 Server      System Manufacturer: 'Dell Inc.', System Model: 'Inspiron 1545'.
2010-01-30 12:58:59.01 Server      Authentication mode is MIXED.
2010-01-30 12:58:59.02 Server      Logging SQL Server messages in file 'c:\Program Files\Microsoft SQL Server\MSSQL10.SQLEXPRESS\MSSQL\Log\ERRORLOG'.
2010-01-30 12:58:59.02 Server      This instance of SQL Server last reported using a process ID of 7396 at 1/30/2010 12:57:38 PM (local) 1/30/2010 5:57:38 PM (UTC). This is an informational message only; no user action is required.
2010-01-30 12:58:59.02 Server      Registry startup parameters: 
     -d c:\Program Files\Microsoft SQL Server\MSSQL10.SQLEXPRESS\MSSQL\DATA\master.mdf
     -e c:\Program Files\Microsoft SQL Server\MSSQL10.SQLEXPRESS\MSSQL\Log\ERRORLOG
     -l c:\Program Files\Microsoft SQL Server\MSSQL10.SQLEXPRESS\MSSQL\DATA\mastlog.ldf
2010-01-30 12:58:59.02 Server      SQL Server is starting at normal priority base (=7). This is an informational message only. No user action is required.
2010-01-30 12:58:59.02 Server      Detected 2 CPUs. This is an informational message; no user action is required.
2010-01-30 12:58:59.08 Server      Using dynamic lock allocation.  Initial allocation of 2500 Lock blocks and 5000 Lock Owner blocks per node.  This is an informational message only.  No user action is required.
2010-01-30 12:58:59.17 Server      Node configuration: node 0: CPU mask: 0x00000003 Active CPU mask: 0x00000003. This message provides a description of the NUMA configuration for this computer. This is an informational message only. No user action is required.
2010-01-30 12:58:59.30 spid7s      Starting up database 'master'.
2010-01-30 12:58:59.41 spid7s      Recovery is writing a checkpoint in database 'master' (1). This is an informational message only. No user action is required.
2010-01-30 12:58:59.67 spid7s      FILESTREAM: effective level = 0, configured level = 0, file system access share name = 'SQLEXPRESS'.
2010-01-30 12:58:59.92 spid7s      SQL Trace ID 1 was started by login "sa".
2010-01-30 12:58:59.94 spid7s      Starting up database 'mssqlsystemresource'.
2010-01-30 12:58:59.95 spid7s      The resource database build version is 10.00.2531. This is an informational message only. No user action is required.
2010-01-30 12:59:00.82 spid7s      Server name is 'DELL\SQLEXPRESS'. This is an informational message only. No user action is required.
2010-01-30 12:59:00.83 Server      A self-generated certificate was successfully loaded for encryption.
2010-01-30 12:59:00.84 Server      Server is listening on [ 'any'  1433].
2010-01-30 12:59:00.84 Server      Server is listening on [ 'any'  1433].
2010-01-30 12:59:00.84 spid10s     Starting up database 'model'.
2010-01-30 12:59:00.85 Server      Server local connection provider is ready to accept connection on [ \\.\pipe\SQLLocal\SQLEXPRESS ].
2010-01-30 12:59:00.86 Server      Server local connection provider is ready to accept connection on [ \\.\pipe\MSSQL$SQLEXPRESS\sql\query ].
2010-01-30 12:59:00.86 Server      Dedicated administrator connection support was not started because it is disabled on this edition of SQL Server. If you want to use a dedicated administrator connection, restart SQL Server using the trace flag 7806. This is an informational message only. No user action is required.
2010-01-30 12:59:00.87 Server      The SQL Server Network Interface library could not register the Service Principal Name (SPN) for the SQL Server service. Error: 0x54b, state: 3. Failure to register an SPN may cause integrated authentication to fall back to NTLM instead of Kerberos. This is an informational message. Further action is only required if Kerberos authentication is required by authentication policies.
2010-01-30 12:59:00.87 spid7s      Informational: No full-text supported languages found.
2010-01-30 12:59:00.87 Server      SQL Server is now ready for client connections. This is an informational message; no user action is required.
2010-01-30 12:59:00.91 spid7s      Starting up database 'msdb'.
2010-01-30 12:59:01.21 spid10s     Clearing tempdb database.
2010-01-30 12:59:02.78 spid10s     Starting up database 'tempdb'.
2010-01-30 12:59:03.30 spid13s     The Service Broker protocol transport is disabled or not configured.
2010-01-30 12:59:03.30 spid13s     The Database Mirroring protocol transport is disabled or not configured.
2010-01-30 12:59:03.31 spid7s      Recovery is complete. This is an informational message only. No user action is required.
2010-01-30 12:59:03.31 spid13s     Service Broker manager has started.

networking
sql-server
connection
localhost
windows
asked on Server Fault Jan 31, 2010 by Adam A • edited Jun 11, 2020 by Community

8 Answers

0

Edited my answer based on your additional info.

I would follow all of the steps here and let us know.

answered on Server Fault Jan 31, 2010 by GregD • edited Jan 31, 2010 by GregD
0

You should use localhost\SQLEXPRESS to connect to the local instance of SQL Server - assuming the instance is called SQLEXRESS.

I noticed that in your comments you say that you are getting an error when you do this, can you please post it because it might help to solve your problem.

Also, instead of using 127.0.0.1 you can use .\SQLEXPRESS in your connection strings to connect to the local instance of SQL Server Express.

answered on Server Fault Feb 1, 2010 by Waleed Al-Balooshi
0

Try enabling remote connections temporarily, it may be that SQL Server sees a hostname and thinks that it's a remote connection.

answered on Server Fault Feb 1, 2010 by ta.speot.is
0

Some ideas...

  1. Have you checked your scope options for your firewall rules for UDP 1434? Try explicitly allowing localhost in a custom list.
  2. Have you tried disabling your firewall on your test server? I wonder if one of your rules has a funky scope option. Doubtful, but worth doing a test and posting the results as new information.
  3. Do you have any UDP services on the test server that you can try testing with? For example, setup an NTP server that syncs with something out on the Internet, and then setup your test server to sync its clock using that. If it works, you know "localhost" works, and your problem with localhost and SQL Server 08 Express is specific to the two.

Unfortunately, it doesn't look like you can easily do a localhost packet capture (so you're SOL there)...which would have been neat to see.

If you've already resolved this, I'd be curious to know what the answer was.

answered on Server Fault Oct 15, 2010 by Kyle • edited Dec 19, 2011 by Kyle
0

When you connect to the server in SSMS, what happens if you specify named pipes instead of TCP/IP as the network protocol in the Options, connection Properties?

here is my netstat, if it helps:

C:\Users\fff>netstat -ano | findstr 1433 TCP 0.0.0.0:1433
0.0.0.0:0 LISTENING 3680 TCP [::]:1433 [::]:0 LISTENING 3680

C:\Users\fff>netstat -ano | findstr 1434 TCP 127.0.0.1:1434
0.0.0.0:0 LISTENING 3680 TCP [::1]:1434 [::]:0 LISTENING 3680 UDP 0.0.0.0:1434
: 2644 UDP [::]:1434 : 2644

answered on Server Fault May 16, 2012 by demp
0

So a few minor issues here. Port 1434 UDP is for the SQL Server Browser service. This is like SQL DNS where it will map your request for a named instance to a port number. SQL assigns port numbers dynamically to the named instances and reserves 1433 TCP for the default installation, which I don't think Express does.

Please try this and report back your findings: 127.0.0.1,1433 localhost,1433 .,1433

This is the same as specifying the name. Open up SQL Profiler, and look for 'failed logins, successful logins' under the 'security audit' tab. This will show you if you're even connecting to the SQL Engine. If you don't see the log on attempt, you're not hitting the engine which means it's being blocked.

Can you try changing the port from 1433 to something else such as 11433 and report back? Did you remove the 0 in 'dynamic port' in SQL Configuration manager per network adapter? That could help too.

answered on Server Fault Sep 19, 2014 by Ali Razeghi
0

Timed out. Never got an answer that worked, but this was way too long ago to find one now. Thanks for everyone who tried to help.

answered on Server Fault Oct 7, 2014 by Adam A
-2

"My hosts file contains the default entries ("127.0.0.1 localhost" and "::1 localhost")"

Can you try to delete "::1 localhost" in HOSTS. For me it looks unnecessary and confusing (to which one localhost is supposed to resolve?). For ex., my HOSTS doesn't have it (only "localhost 127.0.0.1") and resolves localhost though differently

ping -a localhost resolves to ""::1" with network connection enabled and to 127.0.0.1 when network connection is disabled

Also, try to disable IPv6 on NIC TCP/IP properties or NIC connection just to narrow the area.

Waiting to hear your results!


Update1 (continuing to speak with myself, very exciting!):

answered on Server Fault Aug 16, 2010 by Gennady Vanin Геннадий Ванин • edited Mar 20, 2017 by Community

User contributions licensed under CC BY-SA 3.0