SQL Server CE的某些计算机上极其缓慢 [英] SQL Server CE extremely slow on some computers
问题描述
我建立的一个默认情况下使用SQL Server CE 4.0的应用程序,但也可以使用一个单独的SQL Server(SQL Server Express的)。
I've built an app that uses SQL Server CE 4.0 by default, but can also use a separate SQL Server (SQL Server Express).
我已经它部署在办公室约10台计算机和它的作品除了在其中2罚款:副总裁和QA的家伙,当然: - /
I've deployed it to about 10 computers around the office and it works fine except on 2 of them: the VP and a QA guy, of course :-/
在这些计算机上,数据库访问正在围绕每30秒!
。如果我安装SQL Server Express 2008 R2,并告诉我的应用程序,而不是使用它,那么它的运行速度非常快。
On these computers, the database accesses are taking around 30 seconds each! If I install SQL Server Express 2008 R2, and tell my app to use it instead, then it runs very fast.
- 两个问题的机器的WinXP SP3的,但大多数的工作的PC是XP还。
- 我使用C#.NET 4.0应用程序通过使用的ClickOnce的SQL Server CE专用部署。
- 我用
DbProviderFactory
允许访问这两个SQL Server Express的或相同的查询文本(或数据适配器的SQL Server CE )。 - 大多数查询很简单。一些用
的DataAdapter
- 几乎所有的查询最终返回的数据,但我看见一个人在我的日志文件中返回的空,无错误/例外,但应该有20〜40行和80列。
- 对于每个查询,我创建,打开和关闭连接。我不清楚,如果这是必需/推荐/不推荐使用SQL Server CE。
- Both problem machines are WinXP SP3, but most of the working PCs are XP also.
- I'm using C#.NET 4.0 App uses private deployment of SQL Server CE via ClickOnce.
- I'm using
DbProviderFactory
to allow access to both SQL Server Express or SQL Server CE with the same query text (or data adapters). - Most of the queries are simple. A few use
DataAdapter
- Almost all of the queries eventually return data, but I saw one in my log file that returned empty, without an error/exception, but should have had about 20-40 rows and about 80 columns.
- For every query, I create, open and close the connection. I am unclear if this is required/recommended/not-recommended with SQL Server CE.
我不明白为什么这个应用的工作原理大多数PC上,但不能在这几个。
I can't understand why this app works on most PCs, but not on these few.
任何意见都欢迎。
谢谢!
推荐答案
中间的原因和解决方法这个问题是用户访问受密码保护的数据库所使用的.NET加密文件。问题是通过改变文件夹的权限解决。
The intermediate cause and workaround for this problem is with User access to .NET cryptography files used by a password-protected database. The problem was solved by changing the permissions on the folder.
您可以打开运行作为管理员命令提示符并发出以下命令(Win XP的)
You can open command prompt with Run-As Admin and issue this command (Win XP)
cacls.exe "C:\Documents and Settings\All Users\Application Data\Microsoft\Crypto\RSA\MachineKeys" /E /G Everyone:R
我还添加了此评论我的附近的SQLCE连接字符串代码代码:
I also added this comment to my code near the SQLCE connection string code:
/**************************************************************************************
* To get rid of the slowdown on non-admin users you need to grant them read access to this folder:
* C:\Documents and Settings\All Users\Application Data\Microsoft\Crypto\RSA\MachineKeys (XP, 2003)
* C:\Users\All Users\Microsoft\Crypto\RSA\MachineKeys (Windows 7 or 2008)
**************************************************************************************/
这问题是这里所说:的 SQLCE下打开Windows XP中的
This issue is mentioned here: SqlCe opens slow under a limited user account in Windows XP
在这里,一个受限用户帐户缓慢:的 http://social.msdn.microsoft.com/Forums/sqlserver/en-US/eb6a01a7-0bfd -41e3-b4c8-34581c5ccaa3 / SQL-紧凑4锁-UP-30秒-时,访问加密的数据库,在窗口XP-时,磨合?论坛= SQLCE
And here: http://social.msdn.microsoft.com/Forums/sqlserver/en-US/eb6a01a7-0bfd-41e3-b4c8-34581c5ccaa3/sql-compact-4-locks-up-30seconds-when-accessing-encrypted-database-on-windows-xp-when-running-in?forum=sqlce
请注意:有问题的机器上,该... \MachineKeys文件夹是可见的WinExplorer,但文件不能真正被读取。 所有人有特殊的权限,并没有让阅读。我认为.NET可能已被管理员域名,而不是本地管理员安装。
Note: on the problem machine, the ...\MachineKeys folder was visible in WinExplorer, but the files couldn't actually be read. "Everyone" had "special" permissions that didn't allow "Read". I think .NET may have been installed by Domain admin, not local admin.
这只是一种变通方法。我还是不明白,为什么文件夹对几台机器,但不休息怪异的权限。我使用ClickOnce部署,所以我不能自动更改文件夹的权限。
This is only a workaround. I still don't understand why the folder had weird permissions on a few machines but not the rest. I am deploying with ClickOnce, so I can't change the folder permissions automatically.
我只看到了这个问题,XP,和其他职位暗示这只是一个XP的问题,所以希望我不会担心它长。 ..
I have only seen this problem with XP, and other posts imply that this is just an XP problem, so hopefully I won't have to worry about it for long...
这篇关于SQL Server CE的某些计算机上极其缓慢的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!