Solved

SMO - Firewall on server stopping SMO from connecting

Posted on 2010-11-25
3
355 Views
Last Modified: 2013-12-17
Hi,

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)
        {
            try
            {
                // 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)
            {
                return false;
            }
        }

0
Comment
Question by:Beornide
3 Comments
 

Author Comment

by:Beornide
ID: 34213589
OK figured it out on my own : You need to open up the 1434 UDP port on the server fiewall to allow SMO to enumerate servers... what a pain.

Problem solved

Beornide
0
 
LVL 18

Accepted Solution

by:
Richard Lee earned 250 total points
ID: 34213590
TCP port 1433 needs to be open but check this article for more information.

http://support.microsoft.com/kb/287932

DaTribe
0
 
LVL 52

Assisted Solution

by:Carl Tawn
Carl Tawn earned 250 total points
ID: 34213600
You can use the script found at the following link to open all of the necessary ports:

    http://support.microsoft.com/kb/968872
0

Featured Post

Master Your Team's Linux and Cloud Stack

Come see why top tech companies like Mailchimp and Media Temple use Linux Academy to build their employee training programs.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

by Mark Wills Attending one of Rob Farley's seminars the other day, I heard the phrase "The Accidental DBA" and fell in love with it. It got me thinking about the plight of the newcomer to SQL Server...  So if you are the accidental DBA, or, simp…
A long time ago (May 2011), I have written an article showing you how to create a DLL using Visual Studio 2005 to be hosted in SQL Server 2005. That was valid at that time and it is still valid if you are still using these versions. You can still re…
Two types of users will appreciate AOMEI Backupper Pro: 1 - Those with PCIe drives (and haven't found cloning software that works on them). 2 - Those who want a fast clone of their boot drive (no re-boots needed) and it can clone your drive wh…

839 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question