SQL Server 08 Express error when connecting to localhost - "Timeout expired". Works with ::1 or 127.0.0.1
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.
Related videos on Youtube
Comments
-
Adam A over 1 year
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.
-
GregD over 14 yearsTry "localhost\sqlexpress"
-
Adam A over 14 yearsNo luck with server name "localhost\sqlexpress". Different error though. "A network-related or instance-specific error....server was not found or not accessible..." I also tried "{server name}\sqlexpress" which in my case is "DELL\sqlexpress", and got the same error. Just "DELL" gives me the error above ("Timeout expired...")
-
Gennady Vanin Геннадий Ванин over 13 yearssee Update1 in my answer
-
Adam A over 14 years1. I don't have this. I'm using SQL 2008 Express. Is there somewhere else I should look for 2008? 2. The SQLEXPRESS service is running as Network Service. Sql Server Browser is running as Local Service. 3. How can I check this? I'm not sure it could be the difference between localhost and 127.0.0.1 4. Created exceptions on the ports that sql service is running on (see question body). 1. 127.0.0.1 works. 2. What exception do I need for this? Just the UDP on port 1434? Got that one. 3. netstat shows TCP listening on 1433 and UDP on 1434. I'll post the result in the question.
-
Adam A over 14 yearsI thought the connection from the 5XXXX ports were my SSMS connections using 127.0.0.1, but I closed SSMS and still see those. My Web Server isn't running AFAIK.
-
Adam A over 14 yearsAh just lingering. They're gone now.
-
GregD over 14 yearsedited my answer based on your input above
-
Adam A over 14 yearsThe error was along the lines of "A network-related or instance-specific error has occurred. The server was not found or not accessible". Anyway, I shouldn't have to use the name of the instance. I want my connection string to match between my local environment and my production environment. In other words, I want them both to point to simply "localhost". I think you guys are kind of missing the point anyway. using "127.0.0.1" works, but "localhost" doesn't. So the problem has to be something other than naming the instance. It's gotta be something related to the binding of "localhost".
-
Adam A over 14 yearsI've already tried most of that as I listed above. I also checked that I was allowing remote connections (shouldn't matter anyway) but I already was. Remember, the problem is specifically that connecting to "localhost" fails, but connecting to "127.0.0.1" and "::1" both work.
-
Adam A over 14 yearsIt's already enabled.
-
Adam A over 14 yearsNo luck. Good idea though.
-
MDMarra almost 14 years::1 is the IPv6 entry for localhost. It only appears in HOSTS files for operating systems that support IPv6. It is not unnecessary.
-
user2864202 almost 13 yearsYou have to either put the instance name or the port number after the server name. SQLEXPRESS installs as a named instance by default, so the name in the connection string should be SERVERNAME\SQLEXPRESS or SERVERNAME, 1433. The error you are getting is a default message related to a timeout connecting to the instance.