• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 4825
  • Last Modified:

File.Copy From remote server gives error == The specified network name is no longer available.

So, I have log files on a server with an ip of "xxx.xx.xxx.xxx" (lets call it Server X)

I have a script on different server at ip "yyy.yy.yyy.yy" which uses the c# .net  File.Copy to get a local copy of the files on the server X.  Basically, I get the dir on Server X, and say

DirectoryInfo dir = new DirectoryInfo(directoryOnServerX);
FileInfo[] filesInDir = dir.GetFiles();
foreach(FileInfo file in filesInDir){
File.Copy(ServerXDir + file.Name , ServerYDir + file.Name);
}

If Im moving 1 or 2 files, it always works, but if I move 3 or more files the file.copy method starts to choke. it spits out errors of:

          System.IO.IOException: The specified network name is no longer available.      
          at System.IO.__Error.WinIOError(Int32 errorCode, String str)    
          at System.IO.File.InternalCopy(String sourceFileName, String destFileName, Boolean overwrite)
          at System.IO.File.Copy(String sourceFileName, String destFileName, Boolean overwrite)    
          at DealixCore.IO.Copy(String FileFrom, String FileTo, Boolean overwrite)


I think that because Server X and Server Y are different servers on different parts of the internet and there is some lag and my loop moves through my list of files faster then the remote server X (script runs on server Y) can refresh its file system info...???
My question is: How can I get around this?

0
dealix
Asked:
dealix
1 Solution
 
Thandava VallepalliCommented:
try this

http://www.eggheadcafe.com/ng/microsoft.public.windowsme.networking/post19277659.asp


go to Start menu -> All programs -> Administrative tools -> Local Security  
 
Policy  
 
(Opens Local Security settings window)  
 
In the left pane, navigate to security settings -> Local Policies ->  
 
security Options  
 
in the right pane find and make sure that the following settings are  
 
disabled:  
 
Microsoft Network Client: Digitally sign communications(always)  
 
Microsoft Network Client: Digitally sign communications (if server  
 
agrees)  
 
Microsoft Network Server: Digitally sign communications(always)  
 
Microsoft Network Server: Digitally sign communications (if client  
 
agrees)  
 
do this on all pc's and reboot.  
 
It seems that the cause of this problem is a bug in Microsofts SMB driver  
 
signing, and what this solution does is disabling it. (might not be a good  
 
idea if you are on a domain).  
 
Microsoft has a hotfix for this, but the only thing that it did for me was  
 
removing the MrxSmb warnings in my event log?! problem remained though.  
 
I hope that this works for you, otherwise, good hunting


itsvtk
0

Featured Post

Get expert help—faster!

Need expert help—fast? Use the Help Bell for personalized assistance getting answers to your important questions.

Tackle projects and never again get stuck behind a technical roadblock.
Join Now