SMO - Firewall on server stopping SMO from connecting
Posted on 2010-11-25
I have a remote SQL Server Express 2005 sitting on an XP box. My connection to it using SMO from a client Win 7 box fails with an error: 26 - Error Locating Server/Instance Specified
I opened up the firewall on the server to add the sqlservr.exe app to it and I know the server is visible from the win7 client machine since I can register it without problems in the SQL Management Studio on the Win7 machine using Sql Server Security and the same credentials as the ones used with SMO.
If I disable the firewall altogether, SMO connects too.
So what ELSE needs to be opened on the firewall to allow SMO to connect?
Thanks to anyone willing to give me a hand!
Here's the code I use to see if the server exists:
internal static bool serverExists(string serverName, string userCode, string password)
// Go thru a serverConnection to see if this server exists.
ServerConnection connection = new ServerConnection();
connection.LoginSecure = false;
connection.Login = userCode;
connection.Password = password;
connection.ServerInstance = serverName;
Server dbServer = new Server(connection);
//The actual connection is made when a property is retrieved.
return (dbServer.Information.Version != null); ;
catch (Exception ex)