开发者

A network-related or instance-specific error occurred while establishing a connection to SQL Server

开发者 https://www.devze.com 2022-12-29 06:11 出处:网络
I have two databases DB1 (used by my application) and DB2 (third party) under same SQL Server instance

I have two databases DB1 (used by my application) and DB2 (third party) under same SQL Server instance

I get the following error

SqlException ERROR: A network-related or instance-specific error occurred while establishing a connection to SQL Server. The server was not found or was not accessible. Verify that the instance name is correct and that SQL Server is configured to allow remote connections. (provider: Named Pipes Provider, error: 40 - Could not open a connection to SQL Server)

connecting to my database (DB1)

To fix this i used below

To assign a TCP/IP port number to the SQL Server开发者_运维问答 Database Engine In SQL Server Configuration Manager, in the console pane, expand SQL Server Network Configuration, expand Protocols for , and then double-click TCP/IP.

In the TCP/IP Properties dialog box, on the IP Addresses tab, several IP addresses appear in the format IP1, IP2, up to IPAll. One of these is for the IP address of the loopback adapter, 127.0.0.1. Additional IP addresses appear for each IP Address on the computer. Right-click each address, and then click Properties to identify the IP address that you want to configure.

If the TCP Dynamic Ports dialog box contains 0, indicating the Database Engine is listening on dynamic ports, delete the 0.”

Once I deleted those zeros and put in 1433 for TCP ports on each IP address DB1 works fine, but cannot access DB2 (third party)

So basically what is the default settings 0 or 1433?

how do i get both work with default TCP/IP settings?

Thanks Gauls


I was experiencing the same problem with SQL Server Express and resolved it by starting the SQL Server Service located within the SQL Server Configuration Manager.

It should start automatically but a manual restart will resolve the issue.

0

精彩评论

暂无评论...
验证码 换一张
取 消