Invalid or loopback address when configuring SharePoint against a SQL Server

Published Jan 15 2019 03:20 PM 610 Views
Microsoft
First published on MSDN on Oct 04, 2013

I was presented with a connectivity issue when trying to configure SharePoint 2013 using a CTP build of SQL 2014.  They got the following error when they were it was trying to create the Configuration Database.

Exception: System.ArgumentException: myserver,50000 is an invalid or loopback address.  Specify a valid server address.
at Microsoft.SharePoint.Administration.SPServer.ValidateAddress(String address)
at Microsoft.SharePoint.Administration.SPServer..ctor(String address, SPFarm farm, Guid id)
at Microsoft.SharePoint.Administration.SPConfigurationDatabase.RegisterDefaultDatabaseServices(SqlConnectionStringBuilder connectionString)
at Microsoft.SharePoint.Administration.SPConfigurationDatabase.Provision(SqlConnectionStringBuilder connectionString)
at Microsoft.SharePoint.Administration.SPFarm.Create(SqlConnectionStringBuilder configurationDatabase, SqlConnectionStringBuilder administrationContentDatabase, IdentityType identityType, String farmUser, SecureString farmPassword, SecureString masterPassphrase)
at Microsoft.SharePoint.Administration.SPFarm.Create(SqlConnectionStringBuilder configurationDatabase, SqlConnectionStringBuilder administrationContentDatabase, String farmUser, SecureString farmPassword, SecureString masterPassphrase)
at Microsoft.SharePoint.PostSetupConfiguration.ConfigurationDatabaseTask.CreateOrConnectConfigDb()
at Microsoft.SharePoint.PostSetupConfiguration.ConfigurationDatabaseTask.Run()
at Microsoft.SharePoint.PostSetupConfiguration.TaskThread.ExecuteTask()

They had indicated that they had hit this before, and they worked around it by creating a SQL Alias.  However this time it was not working.  It was presented to me as a possible issue with using SQL 2014 and I was asked to have a look to see if this would affect other customers using SQL 2014.

I found some references regarding the error, and the majority of comments indicated to have SQL Server use the default port of 1433.  Also some that said create an Alias.  Some of the SharePoint documentation even shows how to change the SQL Port, and they also show how to create an Alias, but none really explained why this was necessary, or what SharePoint what actually looking for.

For this issue, it has nothing to do with SQL 2014 specifically and could happen with any version of SQL.  The issue is what SharePoint is looking for. Whatever you put in for the Server name needs to be a valid DNS name .  For a non-default port (1433), you would need to create a SQL Alias.  If you create a SQL Alias, the name should be resolvable and not a made up name that doesn’t exist in DNS.  Otherwise, you will get the same error.

Techie Details

I started by looking at the error first.  Of note, this is a SharePoint specific error and not a SQL error.

Exception: System.ArgumentException: myserver,50000 is an invalid or loopback address.  Specify a valid server address.
at Microsoft.SharePoint.Administration.SPServer.ValidateAddress(String address)

This was an ArgumentException when SPServer.ValidateAddress was called.  I’m going to assume that the string being passed in is whatever we entered for the database server.  In my case it would be “myserver,50000”.  I’ve seen this type of behavior before, here is one example .  My first question was, what is ValidateAddress actually doing?  I had an assumption based on the behavior that it was doing a name lookup on what was being passed in, but I don’t like assumptions, so I wanted to verify.

Enter JustDecompile !  This is a create tool if you want to see what .NET Assemblies are really doing.  The trick sometimes is to figure out what the actual assembly is.  I know SharePoint 2013 using the .NET 4.0 Framework, so the assemblies that are GAC’d will be in C:\Windows\Microsoft.NET\assembly\GAC_MSIL.  After that, I go off of the namespace as assemblies are typically aligned to the namespaces that are within it.  I didn’t see an assembly for Microsoft.SharePoint.Administration, so I grabbed the Microsoft.SharePoint assembly within C:\Windows\Microsoft.NET\assembly\GAC_MSIL\Microsoft.SharePoint\v4.0_15.0.0.0__71e9bce111e9429c.  This prompted me to load a few others, but it told me which ones to go get.

Within the Microsoft.SharePoint assembly, we can see that we have the Administration namespace.

So, now we want the SPServer object and the ValidateAddress method.

internal static void ValidateAddress(string address)
{
Uri uri;
if (address == null)
{

throw new ArgumentNullException("address");

}

UriHostNameType uriHostNameType = Uri.CheckHostName(address); <-- This is what gets us into trouble
if (uriHostNameType == UriHostNameType.Unknown)
{
object[] objArray = new object[] { address };
throw new ArgumentException(SPResource.GetString("InvalidServerAddress", objArray)); <-- The exception will be thrown here
}

uri = (uriHostNameType != UriHostNameType.IPv6 ||
address.Length <= 0 ||
address[0] == '[' ||
address[address.Length - 1] == ']' ?
new Uri(string.Concat(" http://" , address)) : new Uri(string.Concat(" http://[" , address, "]")));
if (uri.IsLoopback)
{

object[] objArray1 = new object[] { address };
throw new ArgumentException(SPResource.GetString("InvalidServerAddress", objArray1));
}
}

Uri.CheckHostName Method
http://msdn.microsoft.com/en-us/library/system.uri.checkhostname.aspx

Determines whether the specified host name is a valid DNS name.

So, if the string we pass in cannot be resolved via DNS, it will fail.  We never get to the point where we actually hit SQL itself.

Adam W. Saxton | Microsoft Escalation Services
https://twitter.com/awsaxton

%3CLINGO-SUB%20id%3D%22lingo-sub-317880%22%20slang%3D%22en-US%22%3EInvalid%20or%20loopback%20address%20when%20configuring%20SharePoint%20against%20a%20SQL%20Server%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-317880%22%20slang%3D%22en-US%22%3E%0A%20%26lt%3Bmeta%20http-equiv%3D%22Content-Type%22%20content%3D%22text%2Fhtml%3B%20charset%3DUTF-8%22%20%2F%26gt%3B%3CSTRONG%3E%20First%20published%20on%20MSDN%20on%20Oct%2004%2C%202013%20%3C%2FSTRONG%3E%20%3CBR%20%2F%3E%3CP%3EI%20was%20presented%20with%20a%20connectivity%20issue%20when%20trying%20to%20configure%20SharePoint%202013%20using%20a%20CTP%20build%20of%20SQL%202014.%26nbsp%3B%20They%20got%20the%20following%20error%20when%20they%20were%20it%20was%20trying%20to%20create%20the%20Configuration%20Database.%3C%2FP%3E%0A%20%20%3CBLOCKQUOTE%3E%0A%20%20%20%3CP%3EException%3A%20System.ArgumentException%3A%20myserver%2C50000%20is%20an%20invalid%20or%20loopback%20address.%26nbsp%3B%20Specify%20a%20valid%20server%20address.%20%3CBR%20%2F%3E%20at%20Microsoft.SharePoint.Administration.SPServer.ValidateAddress(String%20address)%20%3CBR%20%2F%3E%20at%20Microsoft.SharePoint.Administration.SPServer..ctor(String%20address%2C%20SPFarm%20farm%2C%20Guid%20id)%20%3CBR%20%2F%3E%20at%20Microsoft.SharePoint.Administration.SPConfigurationDatabase.RegisterDefaultDatabaseServices(SqlConnectionStringBuilder%20connectionString)%20%3CBR%20%2F%3E%20at%20Microsoft.SharePoint.Administration.SPConfigurationDatabase.Provision(SqlConnectionStringBuilder%20connectionString)%20%3CBR%20%2F%3E%20at%20Microsoft.SharePoint.Administration.SPFarm.Create(SqlConnectionStringBuilder%20configurationDatabase%2C%20SqlConnectionStringBuilder%20administrationContentDatabase%2C%20IdentityType%20identityType%2C%20String%20farmUser%2C%20SecureString%20farmPassword%2C%20SecureString%20masterPassphrase)%20%3CBR%20%2F%3E%20at%20Microsoft.SharePoint.Administration.SPFarm.Create(SqlConnectionStringBuilder%20configurationDatabase%2C%20SqlConnectionStringBuilder%20administrationContentDatabase%2C%20String%20farmUser%2C%20SecureString%20farmPassword%2C%20SecureString%20masterPassphrase)%20%3CBR%20%2F%3E%20at%20Microsoft.SharePoint.PostSetupConfiguration.ConfigurationDatabaseTask.CreateOrConnectConfigDb()%20%3CBR%20%2F%3E%20at%20Microsoft.SharePoint.PostSetupConfiguration.ConfigurationDatabaseTask.Run()%20%3CBR%20%2F%3E%20at%20Microsoft.SharePoint.PostSetupConfiguration.TaskThread.ExecuteTask()%3C%2FP%3E%0A%20%20%3C%2FBLOCKQUOTE%3E%0A%20%20%3CP%3EThey%20had%20indicated%20that%20they%20had%20hit%20this%20before%2C%20and%20they%20worked%20around%20it%20by%20creating%20a%20SQL%20Alias.%26nbsp%3B%20However%20this%20time%20it%20was%20not%20working.%26nbsp%3B%20It%20was%20presented%20to%20me%20as%20a%20possible%20issue%20with%20using%20SQL%202014%20and%20I%20was%20asked%20to%20have%20a%20look%20to%20see%20if%20this%20would%20affect%20other%20customers%20using%20SQL%202014.%3C%2FP%3E%0A%20%20%3CP%3EI%20found%20some%20references%20regarding%20the%20error%2C%20and%20the%20majority%20of%20comments%20indicated%20to%20have%20SQL%20Server%20use%20the%20default%20port%20of%201433.%26nbsp%3B%20Also%20some%20that%20said%20create%20an%20Alias.%26nbsp%3B%20Some%20of%20the%20SharePoint%20documentation%20even%20shows%20how%20to%20change%20the%20SQL%20Port%2C%20and%20they%20also%20show%20how%20to%20create%20an%20Alias%2C%20but%20none%20really%20explained%20why%20this%20was%20necessary%2C%20or%20what%20SharePoint%20what%20actually%20looking%20for.%3C%2FP%3E%0A%20%20%3CP%3EFor%20this%20issue%2C%20it%20has%20nothing%20to%20do%20with%20SQL%202014%20specifically%20and%20could%20happen%20with%20any%20version%20of%20SQL.%26nbsp%3B%20The%20issue%20is%20what%20SharePoint%20is%20looking%20for.%20%3CSTRONG%3E%20Whatever%20you%20put%20in%20for%20the%20Server%20name%20needs%20to%20be%20a%20valid%20DNS%20name%20%3C%2FSTRONG%3E%20.%26nbsp%3B%20For%20a%20non-default%20port%20(1433)%2C%20you%20would%20need%20to%20create%20a%20SQL%20Alias.%26nbsp%3B%20If%20you%20create%20a%20SQL%20Alias%2C%20the%20name%20should%20be%20resolvable%20and%20not%20a%20made%20up%20name%20that%20doesn%E2%80%99t%20exist%20in%20DNS.%26nbsp%3B%20Otherwise%2C%20you%20will%20get%20the%20same%20error.%3C%2FP%3E%0A%20%20%3CP%3E%3C%2FP%3E%0A%20%20%3CH2%20id%3D%22toc-hId--1322978131%22%20id%3D%22toc-hId--1237028273%22%3ETechie%20Details%3C%2FH2%3E%0A%20%20%3CP%3EI%20started%20by%20looking%20at%20the%20error%20first.%26nbsp%3B%20Of%20note%2C%20this%20is%20a%20SharePoint%20specific%20error%20and%20not%20a%20SQL%20error.%3C%2FP%3E%0A%20%20%3CBLOCKQUOTE%3E%0A%20%20%20%3CP%3EException%3A%20System.ArgumentException%3A%20myserver%2C50000%20is%20an%20invalid%20or%20loopback%20address.%26nbsp%3B%20Specify%20a%20valid%20server%20address.%20%3CBR%20%2F%3E%20at%20Microsoft.SharePoint.Administration.SPServer.ValidateAddress(String%20address)%3C%2FP%3E%0A%20%20%3C%2FBLOCKQUOTE%3E%0A%20%20%3CP%3EThis%20was%20an%20ArgumentException%20when%20SPServer.ValidateAddress%20was%20called.%26nbsp%3B%20I%E2%80%99m%20going%20to%20assume%20that%20the%20string%20being%20passed%20in%20is%20whatever%20we%20entered%20for%20the%20database%20server.%26nbsp%3B%20In%20my%20case%20it%20would%20be%20%E2%80%9Cmyserver%2C50000%E2%80%9D.%26nbsp%3B%20I%E2%80%99ve%20seen%20this%20type%20of%20behavior%20before%2C%20here%20is%20one%20%3CA%20href%3D%22http%3A%2F%2Fblogs.msdn.com%2Fb%2Fpsssql%2Farchive%2F2009%2F03%2F05%2Fsocketexception-when-creating-a-new-report-server-database.aspx%22%20target%3D%22_blank%22%20rel%3D%22noopener%20noreferrer%22%3E%20example%20%3C%2FA%3E%20.%26nbsp%3B%20My%20first%20question%20was%2C%20what%20is%20ValidateAddress%20actually%20doing%3F%26nbsp%3B%20I%20had%20an%20assumption%20based%20on%20the%20behavior%20that%20it%20was%20doing%20a%20name%20lookup%20on%20what%20was%20being%20passed%20in%2C%20but%20I%20don%E2%80%99t%20like%20assumptions%2C%20so%20I%20wanted%20to%20verify.%3C%2FP%3E%0A%20%20%3CP%3EEnter%20%3CA%20href%3D%22http%3A%2F%2Fwww.telerik.com%2Fproducts%2Fdecompiler.aspx%22%20target%3D%22_blank%22%20rel%3D%22nofollow%20noopener%20noreferrer%22%3E%20JustDecompile%20%3C%2FA%3E%20!%26nbsp%3B%20This%20is%20a%20create%20tool%20if%20you%20want%20to%20see%20what%20.NET%20Assemblies%20are%20really%20doing.%26nbsp%3B%20The%20trick%20sometimes%20is%20to%20figure%20out%20what%20the%20actual%20assembly%20is.%26nbsp%3B%20I%20know%20SharePoint%202013%20using%20the%20.NET%204.0%20Framework%2C%20so%20the%20assemblies%20that%20are%20GAC%E2%80%99d%20will%20be%20in%20C%3A%5CWindows%5CMicrosoft.NET%5Cassembly%5CGAC_MSIL.%26nbsp%3B%20After%20that%2C%20I%20go%20off%20of%20the%20namespace%20as%20assemblies%20are%20typically%20aligned%20to%20the%20namespaces%20that%20are%20within%20it.%26nbsp%3B%20I%20didn%E2%80%99t%20see%20an%20assembly%20for%20Microsoft.SharePoint.Administration%2C%20so%20I%20grabbed%20the%20Microsoft.SharePoint%20assembly%20within%20C%3A%5CWindows%5CMicrosoft.NET%5Cassembly%5CGAC_MSIL%5CMicrosoft.SharePoint%5Cv4.0_15.0.0.0__71e9bce111e9429c.%26nbsp%3B%20This%20prompted%20me%20to%20load%20a%20few%20others%2C%20but%20it%20told%20me%20which%20ones%20to%20go%20get.%3C%2FP%3E%0A%20%20%3CP%3EWithin%20the%20Microsoft.SharePoint%20assembly%2C%20we%20can%20see%20that%20we%20have%20the%20Administration%20namespace.%3C%2FP%3E%0A%20%20%3CBLOCKQUOTE%3E%0A%20%20%20%3CP%3E%3CIMG%20src%3D%22https%3A%2F%2Ftechcommunity.microsoft.com%2Ft5%2Fimage%2Fserverpage%2Fimage-id%2F67761iE22EDBCF6F52291D%22%20%2F%3E%3C%2FP%3E%0A%20%20%3C%2FBLOCKQUOTE%3E%0A%20%20%3CP%3ESo%2C%20now%20we%20want%20the%20SPServer%20object%20and%20the%20ValidateAddress%20method.%3C%2FP%3E%0A%20%20%3CBLOCKQUOTE%3E%0A%20%20%20%3CP%3E%3CIMG%20src%3D%22https%3A%2F%2Ftechcommunity.microsoft.com%2Ft5%2Fimage%2Fserverpage%2Fimage-id%2F67763i4C0C72A5CA9F5C0B%22%20%2F%3E%3C%2FP%3E%0A%20%20%3C%2FBLOCKQUOTE%3E%0A%20%20%3CBLOCKQUOTE%3E%0A%20%20%20%3CP%3Einternal%20static%20void%20ValidateAddress(string%20address)%20%3CBR%20%2F%3E%20%7B%20%3CBR%20%2F%3E%20Uri%20uri%3B%20%3CBR%20%2F%3E%20if%20(address%20%3D%3D%20null)%20%3CBR%20%2F%3E%20%7B%3C%2FP%3E%0A%20%20%20%3CP%3Ethrow%20new%20ArgumentNullException(%22address%22)%3B%3C%2FP%3E%0A%20%20%20%3CP%3E%7D%3C%2FP%3E%0A%20%20%20%3CP%3EUriHostNameType%20uriHostNameType%20%3D%20Uri.CheckHostName(address)%3B%20%26lt%3B--%20This%20is%20what%20gets%20us%20into%20trouble%20%3CBR%20%2F%3E%20if%20(uriHostNameType%20%3D%3D%20UriHostNameType.Unknown)%20%3CBR%20%2F%3E%20%7B%20%3CBR%20%2F%3E%20object%5B%5D%20objArray%20%3D%20new%20object%5B%5D%20%7B%20address%20%7D%3B%20%3CBR%20%2F%3E%20throw%20new%20ArgumentException(SPResource.GetString(%22InvalidServerAddress%22%2C%20objArray))%3B%20%26lt%3B--%20The%20exception%20will%20be%20thrown%20here%20%3CBR%20%2F%3E%20%7D%3C%2FP%3E%0A%20%20%20%3CP%3Euri%20%3D%20(uriHostNameType%20!%3D%20UriHostNameType.IPv6%20%7C%7C%20%3CBR%20%2F%3E%20address.Length%20%26lt%3B%3D%200%20%7C%7C%20%3CBR%20%2F%3E%20address%5B0%5D%20%3D%3D%20'%5B'%20%7C%7C%20%3CBR%20%2F%3E%20address%5Baddress.Length%20-%201%5D%20%3D%3D%20'%5D'%20%3F%20%3CBR%20%2F%3E%20new%20Uri(string.Concat(%22%20%3CA%20href%3D%22http%3A%2F%2F%26quot%3B%22%20target%3D%22_blank%22%20rel%3D%22nofollow%20noopener%20noreferrer%22%3E%20http%3A%2F%2F%22%20%3C%2FA%3E%20%2C%20address))%20%3A%20new%20Uri(string.Concat(%22%20%3CA%20href%3D%22http%3A%2F%2F%5B%26quot%3B%22%20target%3D%22_blank%22%20rel%3D%22nofollow%20noopener%20noreferrer%22%3E%20http%3A%2F%2F%5B%22%20%3C%2FA%3E%20%2C%20address%2C%20%22%5D%22)))%3B%20%3CBR%20%2F%3E%20if%20(uri.IsLoopback)%20%3CBR%20%2F%3E%20%7B%3C%2FP%3E%0A%20%20%20%3CP%3Eobject%5B%5D%20objArray1%20%3D%20new%20object%5B%5D%20%7B%20address%20%7D%3B%20%3CBR%20%2F%3E%20throw%20new%20ArgumentException(SPResource.GetString(%22InvalidServerAddress%22%2C%20objArray1))%3B%20%3CBR%20%2F%3E%20%7D%20%3CBR%20%2F%3E%20%7D%3C%2FP%3E%0A%20%20%3C%2FBLOCKQUOTE%3E%0A%20%20%3CBLOCKQUOTE%3E%0A%20%20%20%3CP%3E%3CSTRONG%3E%20Uri.CheckHostName%20Method%20%3CBR%20%2F%3E%20%3C%2FSTRONG%3E%20%3CA%20href%3D%22http%3A%2F%2Fmsdn.microsoft.com%2Fen-us%2Flibrary%2Fsystem.uri.checkhostname.aspx%22%20target%3D%22_blank%22%20rel%3D%22noopener%20noreferrer%22%3E%20http%3A%2F%2Fmsdn.microsoft.com%2Fen-us%2Flibrary%2Fsystem.uri.checkhostname.aspx%20%3C%2FA%3E%3C%2FP%3E%0A%20%20%20%3CP%3E%3CEM%3E%20Determines%20whether%20the%20specified%20host%20name%20is%20a%20valid%20DNS%20name.%20%3C%2FEM%3E%3C%2FP%3E%0A%20%20%3C%2FBLOCKQUOTE%3E%0A%20%20%3CP%3ESo%2C%20if%20the%20string%20we%20pass%20in%20cannot%20be%20resolved%20via%20DNS%2C%20it%20will%20fail.%26nbsp%3B%20We%20never%20get%20to%20the%20point%20where%20we%20actually%20hit%20SQL%20itself.%3C%2FP%3E%0A%20%20%3CP%3E%3C%2FP%3E%0A%20%20%3CP%3EAdam%20W.%20Saxton%20%7C%20Microsoft%20Escalation%20Services%20%3CBR%20%2F%3E%20%3CA%20href%3D%22https%3A%2F%2Ftwitter.com%2Fawsaxton%22%20target%3D%22_blank%22%20rel%3D%22nofollow%20noopener%20noreferrer%22%3E%20https%3A%2F%2Ftwitter.com%2Fawsaxton%20%3C%2FA%3E%3C%2FP%3E%0A%20%0A%3C%2FLINGO-BODY%3E%3CLINGO-TEASER%20id%3D%22lingo-teaser-317880%22%20slang%3D%22en-US%22%3EFirst%20published%20on%20MSDN%20on%20Oct%2004%2C%202013%20I%20was%20presented%20with%20a%20connectivity%20issue%20when%20trying%20to%20configure%20SharePoint%202013%20using%20a%20CTP%20build%20of%20SQL%202014.%3C%2FLINGO-TEASER%3E%3CLINGO-LABS%20id%3D%22lingo-labs-317880%22%20slang%3D%22en-US%22%3E%3CLINGO-LABEL%3Econnectivity%3C%2FLINGO-LABEL%3E%3C%2FLINGO-LABS%3E
Version history
Last update:
‎Jan 15 2019 03:20 PM
Updated by: