ARTICLE

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

Posted by Mahesh Chand Articles | Error Zone April 26, 2012
Fix for error no connection could be made because the target machine actively refused it.
Reader Level:

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.

 

Login to add your contents and source code to this article
post comment
     
COMMENT USING
PREMIUM SPONSORS
DynamicPDF™ product line allows you to dynamically generate PDF documents, merge PDF documents and add new content to existing PDF documents from within your applications.
SPONSORED BY
  • PDF reports have never been easier to create. With our included WYSIWYG Designer, you can layout your reports, set up your data source and let DynamicPDF ReportWriter do the rest.
Get Career Advice from Experts