2011-05-14 82 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