I tried to copy a .bak-file to the local machine directly after the backup on the server finished.
I never had any problems with that while testing and debugging, but after deployment I got a lot of FileNotFoundExceptions.
I tried to copy a .bak-file to the local machine directly after the backup on the server finished.
I never had any problems with that while testing and debugging, but after deployment I got a lot of FileNotFoundExceptions.
I figured out that, especiall if you do the backup on an other machine, the backupfile needs a little extra time to be ready.
Waiting a little before starting the moving-process solved the problem for me.
Move File
public void WaitForFileToExist(String path) { while (File.Exists(path) == false) { System.Threading.Sleep(10); } }