views:

552

answers:

3

Hi

We have a asp.net 3.5 web application running on a hosting company's web server that's got a very strict firewall setup. The web application communicates with our sql server express 2005 which is on a completely different network.

The problem is that the web applications sends our sql server a random port number to connect to when it connects to our sql server on port 1433. Hence the web application can not connect to our sql server because then they have to open a whole range off port numbers on the firewall which they are not prepared to do.

My question is the following. Can you specify either in your connection string or somewhere in your web.config the port the client sends to sql server to connect back to on?

Thanks

A: 

Is it possible that your SQL Server Express is configured to listen on dynamic ports? If the 'TCP Dynamic Ports' value is 0, I think it will be dynamic even if you have a specific port configured. That value should be cleared completely.

Mufaka
+1  A: 

If I'm getting you right, you want to do something that goes against how TCP/IP port handling is supposed to work.

You want the web application to always use the same port when connecting to your SQL server? This would mean you can only have one connection open at any given time, and so only one user at any given time. The client is supposed to communicate with a server from a "random" port. It's the basics of networking. At least how I learned it.

I'm not sure you can even force it to use the same port every time, and even if you can I'd advice against it.

I'd say the problem is the firewall, and not your application. I can understand that the SQL server only wants to speak to the IP address that your site is on, but it shouldn't really care which port the client wants to talk over (something like [website-ip]:* -> [sql-ip]:1433). To me, it seems like who ever set up the firewall has some kind of crazy firewall ideas, but maybe that's just me.

Marcus L
A: 

You can specify port if you are using TCP/IP.

For ex:

Data Source=190.190.200.100,1433;Network Library=DBMSSOCN;Initial Catalog=myDataBase;User ID=myUsername;Password=myPassword;

where DBMSSOCN=TCP/IP

SoftwareGeek