Reputation: 20031
I use SQL Server in an ASP.Net web application and connect database with this connection string:
<add name="SQLConnectionString"
connectionString="Data Source=204.93.xxx.xxx;Initial Catalog=some_Database;User ID=someUser;Password=somePassword"
providerName="System.Data.SqlClient"/>
Suppose our web server and SQL Server are on same machine then is it the right way of defining a connection string?
If we block SQL Server port 1433 from firewall will this connection string work as here we mention IP of the machine on which SQL Server is and SQL Server connects using port 1433
Or should we use localhost
instead of IP address even then firewall block port 1433 then application might still work?
Upvotes: 0
Views: 237
Reputation: 456
If you are on two separate Machines and you're blocking the port via a firewall, then no you will not be able to communicate to the MS SQL Server Service that is listening on the Port.
If you are on one physical Machine you would not specify the IP Address. You would use the named instance or localhost.
Upvotes: 1