Solved

SMO - Firewall on server stopping SMO from connecting

Posted on 2010-11-25
3
361 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
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

Windows Server 2016: All you need to know

Learn about Hyper-V features that increase functionality and usability of Microsoft Windows Server 2016. Also, throughout this eBook, you’ll find some basic PowerShell examples that will help you leverage the scripts in your environments!

Question has a verified solution.

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

In SQL Server, when rows are selected from a table, does it retrieve data in the order in which it is inserted?  Many believe this is the case. Let us try to examine for ourselves with an example. To get started, use the following script, wh…
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.
Michael from AdRem Software explains how to view the most utilized and worst performing nodes in your network, by accessing the Top Charts view in NetCrunch network monitor (https://www.adremsoft.com/). Top Charts is a view in which you can set seve…
Monitoring a network: how to monitor network services and why? Michael Kulchisky, MCSE, MCSA, MCP, VTSP, VSP, CCSP outlines the philosophy behind service monitoring and why a handshake validation is critical in network monitoring. Software utilized …

624 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