1

我正在开发一个 ASP.NET MVC3 应用程序,使用

  1. 微软 SQL Server 专业版 2008
  2. 微软 VS 2010 专业版
  3. 实体框架作为模型类。

当我通过单击解决方案资源管理器中的 ASP.NET 配置启动 ASP.NET 网站管理工具时,在安全选项卡中显示错误:

无法连接到 SQL Server 数据库。

C:\Windows\Microsoft.NET\Framework\v4.0.30319\Config\machine.config 有一个连接字符串,

<connectionStrings>
        <add name="LocalSqlServer" connectionString="data   source=.\MSSQLSERVER;Integrated Security=SSPI;AttachDBFilename=|DataDirectory|aspnetdb.mdf;User Instance=true" providerName="System.Data.SqlClient"/>
</connectionStrings>

我打开了 C:\Windows\Microsoft.NET\Framework\v4.0.30319\aspnet_regsql.exe 并配置数据库默认名为“aspnetdb”。但情况并没有得到改善。所以,请你帮我解决它。谢谢你。

4

1 回答 1

0

Have you tried the database server that Visual Studio attempts to use?

It should match the one specified in your web.config file.

To check to go: Tools -> Options -> Database Tools -> Design-time Validation Database.

You can then change the SQL Server instance which is used.

于 2012-10-06T11:56:57.233 回答