天天看點

“SQL Server does not allow remote connections”錯誤的解決

安裝DNN 4.8的時候出現這個錯誤

Connection Error(s):

Index #: 0

Source: .Net SqlClient Data Provider

Class: 20

Number: 53

Message:

An error has occurred while establishing a connection to the server.

When connecting to SQL Server 2005, this failure may be caused by the

fact that under the default settings SQL Server does not allow remote

connections. (provider: Named Pipes Provider, error: 40 - Could not

open a connection to SQL Server)

我的機器上安裝了SQL 2000 的Personal版本和SQL 2005 Express(随VS自動安裝的),我使用的是SQL 2000的Personal版本,應該不存在這個問題。在研究一番之後找到了答案。

在沒有安裝SQL 2005 Express之前,我的機器上隻有一個SQL Server,我一般在連接配接字元串裡使用local來指明使用本地的SQL 2000 Personal 版本。安裝Express版後,機器上會存在兩個SQL 的執行個體。如圖:

“SQL Server does not allow remote connections”錯誤的解決

一個是LAND001(我的計算機名),一個是LAND001\SQLEXPRESS。這個時候,如果還是用local來指代SQL Server Personal版本,DNN安裝是不會找Personal版,而是找到 Express版。

解決辦法,連接配接字元串中使用SQL的執行個體名準确指定要使用的SQL Server,比如LAND001。