2011-05-14 99 views
3

我使用本指南的問題: http://www.asp.net/mvc/tutorials/mvc-music-store-part-7ASP.NET MVC:連接到數據庫

指示一樣,我進入到ASP.NET Web Application Administrator,但是當我進入安全標籤:

There is a problem with your selected data store. This can be caused by an invalid server name or credentials, or by insufficient permission. It can also be caused by the role manager feature not being enabled. Click the button below to be redirected to a page where you can choose a new data store.

The following message may help in diagnosing the problem: Unable to connect to SQL Server database.

我做點擊下面的按鈕,但它根本沒有幫助。

到目前爲止,我確實(我想..)像導遊說我應該。 我有一個可怕的感覺,答案是顯而易見的。

編輯1: 順便說一句,當我打開從導向的完整的解決方案,並試圖打開ASP.NET Web Application Administrator,下面的錯誤顯示出來:

There is a problem with your selected data store. This can be caused by an invalid server name or credentials, or by insufficient permission. It can also be caused by the role manager feature not being enabled. Click the button below to be redirected to a page where you can choose a new data store.

The following message may help in diagnosing the problem: 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)

編輯2: 連接字符串:

<connectionStrings> 
    <add name="MusicStoreEntities" 
    connectionString="Data Source=|DataDirectory|MvcMusicStore.sdf" 
    providerName="System.Data.SqlServerCe.4.0"/> 
    </connectionStrings> 

回答

1

你有SQL服務器快速安裝,你有app_data數據庫?

+0

我有精簡版,但數據庫不在App_Data中。該指南不包含任何有關數據庫創建的信息 – 2011-05-14 05:43:27

+0

那麼到目前爲止,該網站是如何爲我工作的? – 2011-05-14 05:44:52

+0

在您的文件系統上查找名爲ASPNETDB.MDF的數據庫 - 這是必需的 - 是嗎?我假設你沒有在應用程序中配置安全性,這就是它工作的原因。在 2011-05-14 06:52:40