File.Copy突然导致“没有足够的存储空间来处理此命令". ... [英] File.Copy suddenly results in "Not enough storage is available to process this command" ...

查看:110
本文介绍了File.Copy突然导致“没有足够的存储空间来处理此命令". ...的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

情况:

我们在c Sharp .NET中开发的应用程序复制了a 一个位置的文件
通过调用File.Copy(...)到另一个.

复制过程,这是一项隐藏操作的一部分,
 每天早上5点运行,每次处理大约15 Mb的文件.
 该文件首先在应用服务器上的
子目录中创建  执行过程(一旦完成)被复制到文件服务器(
 通常是另一台服务器计算机.

该过程从8月中旬到9月20日每天早晨成功运行,
除了在File.Copy
期间发生的几次不同的罕见情况外 引发了以下消息:

找不到网络路径."
系统检测到可能危害安全性的尝试.请确保
您可以联系对您进行身份验证的服务器."

从9月20日开始,每天早上没有知觉,复制过程将失败,并显示以下内容
 出现错误消息:

没有足够的存储空间来处理此命令."

目标服务器仍然有足够的可用存储空间.
 自8月中旬以来,该应用程序未做任何更改,也没有新版本
已安装在应用程序服务器上.

同样奇怪的是,通过Windows手动将文件复制到其目标位置
  Explorer)在相同的Windows帐户下不会出现任何问题.

我们通过在本地运行该应用程序并指定本地目标来测试该应用程序
 文件夹.该测试证明了该应用程序无需执行文件复制即可
没问题.

我经常读到,更改IRPStackSize参数的值可能会
 解决问题.

但是,目标服务器不受我们管理.由于我们没有足够的
权利,我们无法更改服务器注册表中的任何内容.另外,负责任的
服务器部门的人员拒绝接受该问题最终可能会
与服务器有关,他坚信服务器已包含在我们的软件中.

问题:

如果有可能,问题与软件有关,那么可能是什么
 原因?

Thx,Wim

Situation :

An application we developped in c Sharp .NET copies a  file from one location
to another by calling File.Copy(...).

The copy process, which is part of a sheduled operation,
 running each morning at 5am, handles each time a file of about 15 Mb.
 The file, first created on an application server in a sub-directory of the
 executing process is (once finished) copied to a file server (which is
 fysically a different server machine).

The process ran succesfully each morning from mid august until 20 september,
with the exception of a couple of vary rare occasions during which the File.Copy
 rasied the following messages :

"The network path was not found."
 "The system detected a possible attempt to compromise security. Please ensure
that you can contact the server that authenticated you."

As from 20 september, every morning without exeception, the copy process fails with the following
 error message raised :

"Not enough storage is available to process this command."

The target server still has enough storage space available though.
 Since mid august, no changes have been done to the application, nor a new version
 has been installed on the application server.

Also strange is that manually copying the file to its destination (via Windows
 Explorer) under the same Windows account does not pose any problem.

We tested the application by running it locally, and specifying a local target
 folder.  This test proved the application was able to perform the file copy without
 any problem.

I read already often that changing the value of the IRPStackSize parameter might
 solve the problem.

However, the target server is not managed by us.  Since we do not have sufficient
 rights, we can not change anything in the server's registry.  Also, the responsible
 person of the server department refuses to accept that the problem could eventually
 be related to the server, and he is convinced that it is in our software.

Question :

If there is a possiblity the problem is related to the software, what could then be
 the cause?

Thx, Wim

 private static void ProvideFile(String Source, String TargetFolder)
        {
            try
            {
                String sDestinationFileName_Wri = TargetFolder + "\\" + Path.GetFileName(Source);
                String sDestinationFileName_Xml = TargetFolder + "\\" + Path.GetFileNameWithoutExtension(sDestinationFileName_Wri) + ".xml";

                if (File.Exists(sDestinationFileName_Wri))
                    File.Delete(sDestinationFileName_Wri);
                if (File.Exists(sDestinationFileName_Xml))
                    File.Delete(sDestinationFileName_Xml);

                System.Threading.Thread.Sleep(3000);

                File.Copy(Source, sDestinationFileName_Wri, true);
                  while (true)
                {
                    try
                    {
                        FileStream Tester = File.Open(sDestinationFileName_Wri, FileMode.Open, FileAccess.Read, FileShare.Read);
                        Tester.Close();
                        break;
                    }
                    catch
                    { }
                    System.Threading.Thread.Sleep(1000);
                }

                File.Move(sDestinationFileName_Wri, sDestinationFileName_Xml); // rename file *.wri -> *.xml

                ts.TraceEvent(TraceEventType.Information, 22, "Xml target file created, succesfully renamed to '" + sDestinationFileName_Xml + "'...");
            }
            catch (Exception e)
            {
                Console.WriteLine(e.Message);
                ts.TraceEvent(TraceEventType.Error, 29, e.Message);
            }        
        }

推荐答案

几乎与程序无关(9月20日也没有在数据中构建任何地方.环境已更改.请与该环境的所有者联系.
If something suddenly happens, than it is seldom related to the program (there is nowhere build in a data likewise 20 september. The environment has changed. Take contact with the owner of that environment.


这篇关于File.Copy突然导致“没有足够的存储空间来处理此命令". ...的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
相关文章
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆