SQL Server CE - 内部错误:无法打开共享内存区域

发布于 2024-08-27 18:37:33 字数 1586 浏览 4 评论 0原文

我有一个 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 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(2

寂寞美少年 2024-09-03 18:37:33

你说得对,必须安装CE运行时。如果您使用 VS2010,则必须确保安装 CE 运行时的 SP2。

即使安装了它,我也遇到了这个问题。就我而言,我有一个 SQL Server CE 实例,使用 ADO.NET 同步服务充当数据库的本地缓存。这是你的场景吗?

我发现在测试机器上出现此错误:

  • 如果平台是 Vista 或 Windows
    7;如果
  • SQL Server CE 数据库是
    与应用程序一起安装
    驻留在受保护的目录中,例如
    作为 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:

  • If the platform was Vista or Windows
    7; and
  • If the SQL Server CE database was
    installed with the application to
    reside in a protected directory, such
    as C:\Program Files or C:\Program
    Files (x86); and
  • If the program was run using
    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.

遮云壑 2024-09-03 18:37:33

我也有同样的问题。

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

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文