Go Premium for a chance to win a PS4. Enter to Win

x
?
Solved

SMO - Firewall on server stopping SMO from connecting

Posted on 2010-11-25
3
Medium Priority
?
366 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 1000 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 1000 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

Fill in the form and get your FREE NFR key NOW!

Veeam is happy to provide a FREE NFR server license to certified engineers, trainers, and bloggers.  It allows for the non‑production use of Veeam Agent for Microsoft Windows. This license is valid for five workstations and two servers.

Question has a verified solution.

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

In this article we will get to know that how can we recover deleted data if it happens accidently. We really can recover deleted rows if we know the time when data is deleted by using the transaction log.
Real-time is more about the business, not the technology. In day-to-day life, to make real-time decisions like buying or investing, business needs the latest information(e.g. Gold Rate/Stock Rate). Unlike traditional days, you need not wait for a fe…
This video shows how to quickly and easily deploy an email signature for all users in Office 365 and prevent it from being added to replies and forwards. (the resulting signature is applied on the server level in Exchange Online) The email signat…
Want to learn how to record your desktop screen without having to use an outside camera. Click on this video and learn how to use the cool google extension called "Screencastify"! Step 1: Open a new google tab Step 2: Go to the left hand upper corn…

824 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