本机没安装SQL Server Express但要使用aspnetdb库的解决方法

     首先本机要安装SQL Server 2005,然后到C:\WINDOWS\Microsoft.NET\Framework\v2.0.50727 目录执行aspnet_regsql.exe,创建上aspnetdb数据库。然后在Web应用中覆盖machine.config中LocalSqlServer的配置,对Web.config中进行如下配置:

<configuration>

 <connectionStrings>

         <remove name="LocalSqlServer"/>

          <!-- Windows 身份验证 -->

         <add name="LocalSqlServer" connectionString="Data Source=.;Initial Catalog=aspnetdb;Integrated Security=True"  providerName="System.Data.SqlClient"/>

  </connectionStrings>

</configuration>

 

 

 

你可能感兴趣的:(SQL Server)