SocketException when creating a new Report Server Database

We had a customer call up that encountered a problem when trying to create a new database for their Report Server through the Reporting Services Configuration Manager.  This is what they saw:


When we clicked on the Error link, we saw the following details:

System.Net.Sockets.SocketException: No such host is known
at System.Net.Dns.GetAddrInfo(String name)
at System.Net.Dns.InternalGetHostByName(String hostName, Boolean includeIPv6)
at System.Net.Dns.GetHostEntry(String hostNameOrAddress)
at ReportServicesConfigUI.RSDatabase.IsLocalDbServer(String dbServer)
at ReportServicesConfigUI.RSDatabase.GrantRSConnectionRights()
at ReportServicesConfigUI.RSDatabase.CreateNewDatabase()

The server name that we had specified was in the format of SERVER,PORT.  The reason was because there was a firewall in between the Report Server and the Database server.  The Database server was a Named Instance and UDP 1434 was being blocked which is the port for SQL Browser.  We use SQL Browser to convert the Named Instance name to the actual Port number, or named pipe, of the Named Instance.  With SQL Browser not available, we have to specify the actual port number so that we can connect to the database.

From the screenshot above, it looks like we were able to connect to the database as “Running database script” was successful.  Also the “Test Connection” button on the Database Server part of the wizard connected successfully.  So, we got a dump of the error to see what was happening.

The first thing I did when I opened the dump was to load the .NET debugging extension that ships with the .NET Framework called SOS.

0:009> .loadby sos mscorwks

You’ll also notice that we are on Thread 9.  It put me to that thread automatically because it is a crash dump with a given exception.  This makes it easy to find a starting place in your dump.

Next, I wanted to see if the exception in this dump matches what we saw in the Configuration Manager. We can do this by calling !printexception which will print the exception on the given thread you are on.  You can also specify an address for the actual exception.

0:009> !printexception
Exception object: 02a12c44
Exception type: System.Net.Sockets.SocketException
Message: No such host is known
InnerException: <none>
StackTrace (generated):
StackTraceString: <none>
HResult: 80004005

So, this is our guy.  Our call stack at this point is pretty much what we saw in the Exception Details within the Configuration Manager.

0:009> !clrstack
OS Thread Id: 0x1548 (9)
055bf90c 7d4e2366 [HelperMethodFrame: 055bf90c]
055bf9b0 7a580e88 System.Net.Dns.GetAddrInfo(System.String)
055bfa10 7a580bea System.Net.Dns.InternalGetHostByName(System.String, Boolean)
055bfa2c 7a580c7e System.Net.Dns.GetHostEntry(System.String)
055bfa44 06811255 ReportServicesConfigUI.RSDatabase.IsLocalDbServer(System.String)
055bfa58 068110b4 ReportServicesConfigUI.RSDatabase.GrantRSConnectionRights()
055bfa74 06810832 ReportServicesConfigUI.RSDatabase.ChangeRSDatabase()
055bfaa0 06810740 ReportServicesConfigUI.ProgressPanel.PerformWizardActionThread(System.Object)
055bfab4 792c9dff System.Threading._ThreadPoolWaitCallback.WaitCallback_Context(System.Object)
055bfabc 792e019f System.Threading.ExecutionContext.Run(System.Threading.ExecutionContext, System.Threading.ContextCallback, System.Object)
055bfad4 792ca363 System.Threading._ThreadPoolWaitCallback.PerformWaitCallbackInternal(System.Threading._ThreadPoolWaitCallback)
055bfae8 792ca1f9 System.Threading._ThreadPoolWaitCallback.PerformWaitCallback(System.Object)
055bfc78 79e71b4c [GCFrame: 055bfc78]

My thought here is that the IsLocalDbServer is being passed the raw string of my server address and not being parsed.  We can look at that by way of !dso (Dump Stack Objects).

0:009> !dso
OS Thread Id: 0x1548 (9)
ESP/REG Object Name
055bf8a0 02a12c44 System.Net.Sockets.SocketException
055bf8ec 02a12c44 System.Net.Sockets.SocketException
055bf900 02a12c44 System.Net.Sockets.SocketException
055bf904 02a12c18 System.Collections.ArrayList
055bf930 02a12c44 System.Net.Sockets.SocketException
055bf938 02a12c44 System.Net.Sockets.SocketException
055bf940 02a12c18 System.Collections.ArrayList
055bf960 02a12cdc System.Text.StringBuilder
055bf978 02a12cdc System.Text.StringBuilder
055bf98c 02a12c18 System.Collections.ArrayList
055bf994 02a12c44 System.Net.Sockets.SocketException
055bf9b8 02a12c18 System.Collections.ArrayList
055bf9bc 02923f58 System.String myserver,1234
055bf9e4 02a12c30 System.Net.SafeFreeAddrInfo
055bf9fc 02923f58 System.String myserver,1234
055bfa00 02923f58 System.String myserver,1234
055bfa1c 02923f58 System.String myserver,1234
055bfa20 028f3664 ReportServicesConfigUI.RSDatabase

We see RSDatabase at the bottom which matches my IsLocalDbServer method call.  We then see the raw string followed by the SocketException if we work our way up.  Reviewing the IsLocalDbServer method, it does indeed not parse the string for the server name/port. 

So, if you run into this exception, you may want to check what you are passing as your Server name.  You will not be able to specify a port.

Adam W. Saxton | Microsoft SQL Server Escalation Services