Solved

SMO - Firewall on server stopping SMO from connecting

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

Many of us here at EE write code. Many of us write exceptional code; just as many of us write exception-prone code. As we all should know, exceptions are a mechanism for handling errors which are typically out of our control. From database errors, t…
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…
In a recent question (https://www.experts-exchange.com/questions/28997919/Pagination-in-Adobe-Acrobat.html) here at Experts Exchange, a member asked how to add page numbers to a PDF file using Adobe Acrobat XI Pro. This short video Micro Tutorial sh…
The Email Laundry PDF encryption service allows companies to send confidential encrypted  emails to anybody. The PDF document can also contain attachments that are embedded in the encrypted PDF. The password is randomly generated by The Email Laundr…

777 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