我認爲這是更多的連接字符串問題,MVC 3,所以提前抱歉。MVC 3 ASPNETDB.MDF SqlExpress數據庫連接字符串上的虛擬主機
我在MVC 3中創建了一個網站,其中包含在註冊新用戶時創建的默認數據庫。它工作正常,當地卻沒有關於我的虛擬主機,我收到以下錯誤:
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: SQL Network Interfaces, error: 26 - Error Locating Server/Instance Specified)
默認的連接字符串是:
<connectionStrings>
<add name="ApplicationServices" connectionString="data source=.\SQLEXPRESS;Integrated Security=SSPI;AttachDBFilename=|DataDirectory|aspnetdb.mdf;User Instance=true"
providerName="System.Data.SqlClient" />
<add name="ASPNETDBConnectionString" connectionString="Data Source=.\SQLEXPRESS;AttachDbFilename=|DataDirectory|\ASPNETDB.MDF;Integrated Security=True;User Instance=True"
providerName="System.Data.SqlClient" />
我應該指定用顯式的連接字符串服務器的IP地址或保留。\ SQLEXPRESS命令?如果我需要指定用戶名和密碼,那麼我應該使用什麼?我從來沒有使用過本地的SQLExpress數據庫,所以我無能爲力(我確信這很明顯)。
在您的網站託管上,數據庫安裝在哪裏?它甚至還安裝了SQL Express? – BonyT
數據庫位於App_Data目錄中,Web主機狀態爲「SQL Management Express Supported」,但從控制面板看不到任何配置方式(我也不知道配置)我正在等待他們的回覆,但是想知道它是不是一個簡單的連接字符串問題 – pfeds
事實證明,託管提供程序不支持SQL Server Express,所以我需要創建一個標準的SQL數據庫。謝謝你的幫助。 – pfeds