C# File.Copy Not enough quota

丶灬走出姿态 提交于 2020-02-03 09:59:13

问题


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.

The code works without a hitch almost 99.9% of the time but once every few hours I might get the error discussed here.

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. 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 ....


回答1:


Not enough quota is available to process this command means that your system was running low on resources. It's hard to tell what the problem was exactly, but there's almost certainly nothing your code can do but retry the operation.




回答2:


Please check the user permission to write the file. It may be causing due to insufficient user rights to create or overwrite the file.




回答3:


Check if your file is not locked by other process. You can easily do it with Process Explorer




回答4:


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



来源:https://stackoverflow.com/questions/5415507/c-sharp-file-copy-not-enough-quota

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!