?
Solved

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

Posted on 2005-03-23
4
Medium Priority
?
4,741 Views
Last Modified: 2008-03-10
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
Comment
Question by:dealix
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
4 Comments
 
LVL 14

Accepted Solution

by:
Thandava Vallepalli earned 2000 total points
ID: 13619134
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

Free Tool: Path Explorer

An intuitive utility to help find the CSS path to UI elements on a webpage. These paths are used frequently in a variety of front-end development and QA automation tasks.

One of a set of tools we're offering as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Extention Methods in C# 3.0 by Ivo Stoykov C# 3.0 offers extension methods. They allow extending existing classes without changing the class's source code or relying on inheritance. These are static methods invoked as instance method. This…
Real-time is more about the business, not the technology. In day-to-day life, to make real-time decisions like buying or investing, business needs the latest information(e.g. Gold Rate/Stock Rate). Unlike traditional days, you need not wait for a fe…
This is my first video review of Microsoft Bookings, I will be doing a part two with a bit more information, but wanted to get this out to you folks.
In this video you will find out how to export Office 365 mailboxes using the built in eDiscovery tool. Bear in mind that although this method might be useful in some cases, using PST files as Office 365 backup is troublesome in a long run (more on t…

752 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question