信号灯超时时间已过期 [英] Semaphore timeout period has expired

查看:110
本文介绍了信号灯超时时间已过期的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我已经从一个网络共享文件复制到另一个简单的C#程序。该方案只是扔了信号灯超时时间已过期的错误。我从来没见过这个,我好心地是什么糊涂



中的代码很简单:
(中用srcPath和destPath都从配置设置读取)

  DirectoryInfo的DI =新DirectoryInfo的(中用srcPath); 


{

的FileInfo [] =文件di.GetFiles();

的foreach(FileInfo的网络连接文件)
{
如果(!(fi.Name.Contains(_降序)))
{
档.Copy(fi.FullName,destPath + fi.Name,真正的);
}
}
}
赶上(例外XX)
{
的SendMail(xx.Message,xx.StackTrace);
}
终于
{

}


解决方案

这往往是一个通用的错误信息,并可能与三种可能性:




  1. 连接有关。请检查您的网线,USB连接/电缆,重置USB集线器,网络switches..etc。


  2. 检查过长的文件名或路径太长。


  3. 硬盘驱动器有关。检查你有足够的可用空间,并且驱动器没有错误,而不是零散




编辑:新增的硬盘驱动器


I have a simple C# program that copies files from one network share to another. The program just threw a "The semaphore timeout period has expired" error. I've never seen this before and I'm kind of confused as to what it is.

The code is pretty simple: (srcPath and destPath are read from configuration settings)

DirectoryInfo di = new DirectoryInfo(srcPath);

        try
        {

            FileInfo[] files = di.GetFiles();

            foreach (FileInfo fi in files)
            {
                if(!(fi.Name.Contains("_desc")))
                {
                    File.Copy(fi.FullName, destPath + fi.Name, true);
                }
            }
        }
        catch (Exception xx)
        {
            SendMail(xx.Message, xx.StackTrace);
        }
        finally
        {

        }

解决方案

This tends to be a generic error message and is probably related to three possibilities:

  1. Connection related. Check your network cables, USB Connections / cables, reset the usb hub, network switches..etc.

  2. Check for file names that are too long, or paths that are too long.

  3. Hard drive related. Check you have enough free space and that the drive has no errors and is not fragmented.

EDIT: Added hard drive.

这篇关于信号灯超时时间已过期的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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