FoxPro 临时文件问题
我们有以下 Visual FoxPro 9 代码行
INDEX ON batchno TO temp FOR !DELETED()
我们遇到一个问题,FoxPro 编译的应用程序将运行,尝试枚举文件夹的内容,查找临时文件,创建临时文件(名为 temp.idx 的数据库),然后继续进一步处理以引用临时数据。
当我们使用带有 NFS 文件系统的 Novell 目录服务器时,这似乎工作得很好。然而,现在我们已经转移到具有 NTFS 文件系统的 MS Active Directory 服务器,我们遇到了一个问题,即编译后的 FoxPro 应用程序无法再写入文件。
发生错误时,进程监视器显示以下输出:
Operation: CreateFile
Result: SHARING VIOLATION
Desired Access: Generic Read/Write
Disposition: OverwriteIf
Options: Synchronous IO Non-Alert, Non-Directory File
Attributes: N
ShareMode: None
AllocationSize: 0
我很好奇是否有另一种方法可以解决这种情况,即我们不必担心应用程序在尝试写入文件时保持文件处于使用状态(可能是读取状态) ,随后失败,因为它已在使用中。
We have the following line of Visual FoxPro 9 code
INDEX ON batchno TO temp FOR !DELETED()
We are having an issue where a FoxPro compiled application will run, try to enumerate the contents of a folder, look for a temp file, create the temp file (database called temp.idx), and then move on to further processing to reference the temporary data.
This seemed to work fine when we were on a Novell directory server with NFS file system. However, now that we have moved to MS Active Directory server with NTFS file system, we are having an issue such that the compiled FoxPro application is not able to write to the file anymore.
Process Monitor shows the following output when the error occurs:
Operation: CreateFile
Result: SHARING VIOLATION
Desired Access: Generic Read/Write
Disposition: OverwriteIf
Options: Synchronous IO Non-Alert, Non-Directory File
Attributes: N
ShareMode: None
AllocationSize: 0
I was curious if there was an alternate way to approach this situation where we do not have to worry about the application keeping the file in use (presumably read) while it attempts to write the file, where is subsequently fails since it is already in use.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
.IDX 文件是一种包含一个索引的独立索引文件,而 .CDX 是一种可以包含多个索引的复合索引文件。
这是一个权限问题吗?当您以网络管理员身份运行它时它是否有效?
EXE 是在哪个版本的 FoxPro/Visual FoxPro 中编译的?
客户端和服务器操作系统是什么?
A .IDX file is a standalone index file containing one index, as opposed to .CDX which is a compound index file that can contain many.
Is it a permissions issue - does it work when you run it as a network administrator?
What version of FoxPro / Visual FoxPro is the EXE compiled in ?
What are the client and server OS ?
您使用的操作系统很重要!如果该程序在 Windows Vista、7 或 Server 2008 上运行,您将无法不受限制地在任何地方创建文件。
最好的方法是在用户的 TEMP-Directory 中创建此临时索引。在那里,您始终拥有写入或删除文件的完整权限。
如果您只是使用
IDX,则会在默认目录中创建。如果此目录是 C:\Program Files...Windows 的 UAC 将不允许将其写入该目录并将文件重定向到 c:\Windows 下某处的临时目录中。
使用 SYS(2023),您可以获取用户的 TEMP 目录。
所以试试这个:
It's important which OS you are using! If the program runs on Windows Vista, 7 or Server 2008 you are not able to create files everywhere you want without restrictions.
The best way is to create this temporary index in the TEMP-Directory of the user. There you have always full rights do write or delete files.
If you just use
the IDX will be created in the default directory. If this directory is C:\Program Files... the UAC of Windows will not allow to write it there and redirect the file into a temporary directory somewhere under c:\Windows.
With SYS(2023) you are able to get the TEMP-Directory of the user.
So try this: