我已经在 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>
还尝试按照建议复制dllhere https://stackoverflow.com/questions/3223359/cant-get-sql-server-compact-3-5-4-to-work-with-asp-net-mvc-2但没有效果。
终于让 SQL Server Compact Edition 4.0 在 IIS 7.5 下工作了。问题是权限问题。当前的应用程序池的身份IWAM_plesk(默认)无权访问 SQL Server Compact 4.0 文件夹:
C:\Program Files\Microsoft SQL Server Compact Edition\v4.0
C:\Program Files (x86)\Microsoft SQL Server Compact Edition\v4.0
我刚刚授予了读取和执行以及列出文件夹内容权限,现在它就像一个魅力。
本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系:hwhale#tublm.com(使用前将#替换为@)