SQL Network Interfaces, error: 26 when wanting to run a query from a WEB page

0

Greetings.

I have been investigating the following error that appears to me when running a web page that I am programming in VS2013

  

Server error in the application '/'.

     

Error related to the network or specific to the instance while   established a connection to the SQL Server. The   server or this one was not accessible. Check that the name of the   instance is correct and that SQL Server is configured to support   remote connections. (provider: SQL Network Interfaces, error: 26 -   Error searching the specified server or instance)

Among the answers and information I found, it tells me to check the SQL services, the connections (TCP / IP & Named pipelines), the connectionString.

Of all that: * Services are running (including the SQL Browser) * The services of the two instances that I have are running * TCP / IP connections are enabled and with port 1433 configured * The connection string I have declared it in the following ways

<add name="ServProd" connectionString="Data Source=192.168.54.86\TR; Initial Catalog=db; User ID=sa; Password=******;" providerName="System.Data.SqlClient" />

<add name="ServProd" connectionString="Data Source=ambientePROD\TR; Initial Catalog=db; User ID=sa; Password=******;" providerName="System.Data.SqlClient" />

and none of the two ways has worked.

The firewall is configured to allow connections. Even previous pages and applications have no problems connecting to the bases of that server, but this specific development is having this problem.

Any detail that I have skipped checking in code or configuration?

Thanks for your time.

    
asked by Rodrigo Jimenez 28.11.2017 в 01:02
source

2 answers

1

I'm 99% sure that you do not have SQL Server configured for external access:

In SQL Management Studio you right click on your server, select properties and go to connections and then make the option to allow remote connections to the server.

Apart, you open the SQL Server Configuration Manager, expand the SQL Server Network Configuration node and select the "Protocols for MSSQLServer" option (or whatever your instance is called) and make sure that TCP / IP is enabled.

    
answered by 28.11.2017 в 02:26
0

You need the port, try this:

<add name="ServProd" connectionString="Data Source=192.168.54.86\TR,1433; Initial Catalog=db; Persist Security Info=True; User ID=sa; Password=******;" providerName="System.Data.SqlClient" />
    
answered by 28.11.2017 в 01:05