我正在使用这个指南: http://www.asp.net/mvc/tutorials/mvc-music-store-part-7
按照说明,我进入了 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>
最佳答案
您是否安装了 SQL Server Express 并且您在 app_data 中有数据库?
关于c# - ASP.NET MVC : problem connecting to a database,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/5999851/