I created a timer job (via Feature Deployment) that creates a file in hostserver´s filesystem.
private static void myMethod(Byte[] results, string fileName)
{
using (FileStream stream = File.OpenWrite(fileName))
{
stream.Write(results, 0, results.Length);
stream.Close();
stream.Dispose();
}
}
also FileAccess.Write, FileShare etc. in FileStream constructor doesnt work. The created file cannot be deleted neither within the timer process nor with Administrator privileges in Windows Explorer until the timer service has been restarted.
The timer job is been executes via NETWORKService.
In a console application (runs the same code under Administrator privileges) it works properly.
I decided to temporaly create random files in filesystem to sove my problem quickly, but It is not the best case.