SQL Server CE - 内部错误:无法打开共享内存区域
我有一个 SQL Server CE 数据库,在开发环境中运行良好,但安装在客户端时出现问题。
- SQL Server CE 3.5 依赖项将作为部署的一部分进行复制。
- 目标计算机是干净的 Windows 7 32 位旗舰版映像。
事件日志中的异常消息是:
Message: Internal error: Cannot open the shared memory region.
Stack Trace: at System.Data.SqlServerCe.SqlCeConnection.ProcessResults(Int32 hr) at
System.Data.SqlServerCe.SqlCeConnection.Open(Boolean silent) at
System.Data.SqlServerCe.SqlCeConnection.Open() at
System.Data.Linq.SqlClient.SqlConnectionManager.UseConnection(IConnectionUser user) at
System.Data.Linq.SqlClient.SqlProvider.Execute(
Expression query,
QueryInfo queryInfo,
IObjectReaderFactory factory,
Object[] parentArgs,
Object[] userArgs,
ICompiledSubQuery[] subQueries,
Object lastResult) at
System.Data.Linq.SqlClient.SqlProvider.ExecuteAll(
Expression query,
QueryInfo[] queryInfos,
IObjectReaderFactory factory,
Object[] userArguments,
ICompiledSubQuery[]
subQueries) at
System.Data.Linq.SqlClient.SqlProvider.System.Data.Linq.Provider.IProvider.Execute(
Expression query) at
System.Data.Linq.DataQuery`1.System.Collections.Generic.IEnumerable<T>.GetEnumerator() at
System.Collections.Generic.List`1..ctor(IEnumerable`1 collection) at
System.Linq.Enumerable.ToList[TSource](IEnumerable`1 source) at
Application specific stuff here
看起来这是 SSCE_M_CANTOPENSHAREDMEMORY 并且该网站表示没有连接字符串值可以更改此设置,并且最终开发人员通常无法解决这些问题。
有人遇到过这个问题吗?如果是的话,你能解决这个问题吗?
I have a SQL Server CE database that works fine in dev, but when installed on the client has an issue.
- The SQL Server CE 3.5 dependencies are copied as part of the deployment.
- The target machine is a clean Windows 7 32-bit Ultimate image.
The message for the exception in the event log is:
Message: Internal error: Cannot open the shared memory region.
Stack Trace: at System.Data.SqlServerCe.SqlCeConnection.ProcessResults(Int32 hr) at
System.Data.SqlServerCe.SqlCeConnection.Open(Boolean silent) at
System.Data.SqlServerCe.SqlCeConnection.Open() at
System.Data.Linq.SqlClient.SqlConnectionManager.UseConnection(IConnectionUser user) at
System.Data.Linq.SqlClient.SqlProvider.Execute(
Expression query,
QueryInfo queryInfo,
IObjectReaderFactory factory,
Object[] parentArgs,
Object[] userArgs,
ICompiledSubQuery[] subQueries,
Object lastResult) at
System.Data.Linq.SqlClient.SqlProvider.ExecuteAll(
Expression query,
QueryInfo[] queryInfos,
IObjectReaderFactory factory,
Object[] userArguments,
ICompiledSubQuery[]
subQueries) at
System.Data.Linq.SqlClient.SqlProvider.System.Data.Linq.Provider.IProvider.Execute(
Expression query) at
System.Data.Linq.DataQuery`1.System.Collections.Generic.IEnumerable<T>.GetEnumerator() at
System.Collections.Generic.List`1..ctor(IEnumerable`1 collection) at
System.Linq.Enumerable.ToList[TSource](IEnumerable`1 source) at
Application specific stuff here
It looks like this is SSCE_M_CANTOPENSHAREDMEMORY and the site says there isn't a connection string value to change this and that these issues are typically not resolvable by the end developers.
Has anyone run into this, and if so were you able to resolve this issue?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
你说得对,必须安装CE运行时。如果您使用 VS2010,则必须确保安装 CE 运行时的 SP2。
即使安装了它,我也遇到了这个问题。就我而言,我有一个 SQL Server CE 实例,使用 ADO.NET 同步服务充当数据库的本地缓存。这是你的场景吗?
我发现在测试机器上出现此错误:
7;如果
与应用程序一起安装
驻留在受保护的目录中,例如
作为 C:\Program Files 或 C:\Program
文件(x86);如果
标准用户凭证(即
未升级为管理员)
该情况的解决方法包括:
运行应用程序“as
管理员”;或
将应用程序清单配置为需要管理员凭据;或
重构应用程序,使 .sdf 文件位于不受保护的目录中,例如 C:\ProgramData[某个子目录名称] 并修改连接字符串以指向该区域;或
在用户空间中重新定位整个应用程序目录。例如,在“文档”或一些具有 EXE 和 .SDF 文件的完全文件访问权限的类似空间中
显然,每个选项都有其缺点。
You're right that the CE runtime has to be installed. And if you're using VS2010, you have to make sure that you install SP2 of the CE runtimes.
Even with that installed, I've run into this. In my case, I had a SQL Server CE instance acting as a local cache for a database using ADO.NET Synchronization Services. Is this your scenario?
I found that on test machines I got this error:
7; and
installed with the application to
reside in a protected directory, such
as C:\Program Files or C:\Program
Files (x86); and
standard user credentials (i.e.
not escalated to Administrator)
Workarounds for the condition included:
Running the application "as
Administrator"; or
Configuring the application manifest to require Administrator credentials; or
Refactoring the application so that the .sdf file was located in an unprotected directory, such as C:\ProgramData[some subdirectory name] and modifying the connection string to point to that area; or
Relocating the entire application directory in a user space. For instance, in "Documents" or some similar space with full file access rights to the EXE and the .SDF file
Obviously, each of those options has its disadvantages.
我也有同样的问题。
Windows 7。
这是因为用户位于域中并且权限授予“所有人”并且失败。
必须授予%DOMAIN%/大家
尊重
I had the same problem.
Windows 7.
It was because the user was in a Domain and the permissions where granted to "Everyone" and failed.
It must be granted to %DOMAIN%/Everyone
regards