简体   繁体   English

C#File.Copy配额不够

[英]C# File.Copy Not enough quota

I have a large application running on a bunch of machines. 我在一堆机器上运行了一个大型应用程序。 Once every 5 minutes it copies a file to do some manipulation on it. 每5分钟复制一次文件,对其进行一些操作。

The code works without a hitch almost 99.9% of the time but once every few hours I might get the error discussed here. 代码几乎99.9%的时间没有任何障碍,但每隔几个小时我就会得到这里讨论的错误。

Here's the code: 这是代码:

try
 {
  File.Copy(fullPathName, readPathName, true);
 }
catch (Exception exception)
 {
 ....
 }

This code runs in its own thread but should only be one of these threads running. 此代码在其自己的线程中运行,但应该只运行其中一个线程。 Here's the error I get: 这是我得到的错误:

Encountered an unexpected exception when trying to create the .tmp file. 尝试创建.tmp文件时遇到意外的异常。 Not enough quota is available to process this command. 没有足够的配额可用于处理此命令。

at System.IO.__Error.WinIOError(Int32 errorCode, String maybeFullPath) at System.IO.File.InternalCopy(String sourceFileName, String destFileName, Boolean overwrite) at System.IO.File.Copy(String sourceFileName, String destFileName, Boolean overwrite) at .... 在System.IO .__ Error.WinIOError(Int32 errorCode,String maybeFullPath)System.IO.File.InternalCopy(String sourceFileName,String destFileName,Boolean overwrite)at System.IO.File.Copy(String sourceFileName,String destFileName,Boolean overwrite) ) 在 ....

Not enough quota is available to process this command means that your system was running low on resources. Not enough quota is available to process this command意味着您的系统资源不足。 It's hard to tell what the problem was exactly, but there's almost certainly nothing your code can do but retry the operation. 很难说出问题究竟是什么,但几乎可以肯定你的代码无法重做,只能重试操作。

Please check the user permission to write the file. 请检查用户写入文件的权限。 It may be causing due to insufficient user rights to create or overwrite the file. 可能是由于用户权限不足而无法创建或覆盖该文件。

Check if your file is not locked by other process. 检查您的文件是否未被其他进程锁定。 You can easily do it with Process Explorer 您可以使用Process Explorer轻松完成此操作

This sounds like you either have a memory leak in your application, or too little memory set up on your (virtual?) machine. 这听起来像你的应用程序中有内存泄漏,或者(虚拟?)机器上的内存设置太少。

See this link: http://msdn.microsoft.com/en-us/library/ms820778.aspx 请参阅此链接: http//msdn.microsoft.com/en-us/library/ms820778.aspx

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM