我已经在 Win7 x64 上安装了 SQL Server Compact Edition 4.0,它同时适用于 Asp.Net 和桌面应用程序。这台 PC 还安装了 Visual Studio 2010 SP1。但是我的 Server 2008 R2 会为 Asp.Net 应用程序产生以下错误,尽管它可以运行桌面应用程序:
Unable to load the native components of SQL Server Compact corresponding to the
ADO.NET provider of version 8482. Install the correct version of SQL Server
Compact. Refer to KB article 974247 for more details.
我已经尝试过使用 SqlDataSource 和 SqlCeConnection。同样的错误。我的 web.config 如下所示:
<?xml version="1.0"?>
<configuration>
<connectionStrings>
<add name="SQLCE" connectionString="Data Source=|DataDirectory|\a.sdf"
providerName="System.Data.SqlServerCe.4.0" />
</connectionStrings>
<system.web>
<compilation debug="true" targetFramework="4.0">
<assemblies>
<add assembly="System.Data.SqlServerCe, Version=4.0.0.0,
Culture=neutral, PublicKeyToken=89845dcd8080cc91"/>
</assemblies>
</compilation>
</system.web>
</configuration>
还尝试按照此处的建议复制 dll,但没有效果。