Solved

SMO - Firewall on server stopping SMO from connecting

Posted on 2010-11-25
3
335 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

Zoho SalesIQ

Hassle-free live chat software re-imagined for business growth. 2 users, always free.

Join & Write a Comment

For those of you who don't follow the news, or just happen to live under rocks, Microsoft Research released a beta SDK (http://www.microsoft.com/en-us/download/details.aspx?id=27876) for the Xbox 360 Kinect. If you don't know what a Kinect is (http:…
In this article I will describe the Backup & Restore method as one possible migration process and I will add the extra tasks needed for an upgrade when and where is applied so it will cover all.
Illustrator's Shape Builder tool will let you combine shapes visually and interactively. This video shows the Mac version, but the tool works the same way in Windows. To follow along with this video, you can draw your own shapes or download the file…
When you create an app prototype with Adobe XD, you can insert system screens -- sharing or Control Center, for example -- with just a few clicks. This video shows you how. You can take the full course on Experts Exchange at http://bit.ly/XDcourse.

758 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

Need Help in Real-Time?

Connect with top rated Experts

14 Experts available now in Live!

Get 1:1 Help Now