No connection could be made because the target machine actively refused it

No connection could be made because the target machine actively refused it

You may get this error while trying to establish a connection to a SQL Server database remotely. Here are a few things you should check.

  • Make sure your server name is correct.
  • Make sure database server is up and running. You can see MSSQLSERVER service or whatever is your SQL Server instance name is running.
  • Try to ping your server name and see if IP is correct.
  • Ping the IP address and see it is resolving.
  • If your server is behind firewall, you may want to add a port number to your connection string. Port 1433 is the default port for SQL Server.

By default, SQL Server uses port number 1433. To create a connection string over firewall with the IP and port number, use the following format:

<add name="connection" connectionString="Data Source=[YOURIP XX.XX.XX.XX],1433;Network Library=DBMSSOCN;Initial Catalog=[YOURDBNAME];User ID=[YOURUSERID];Password=[YOURPASSWORD]"/>

You need to make sure you replace variables in this connection string with correct values.

 


Similar Articles
Mindcracker
Founded in 2003, Mindcracker is the authority in custom software development and innovation. We put best practices into action. We deliver solutions based on consumer and industry analysis.