Search code examples
c#.net.net-2.0odp.netfilesystemwatcher

FileSystemWatcher C# permission problem


I'm over a domain, reading the path \\machinecap\platform\in.

The platform is a share, wich leads to E:\cappuccino\platform locally. The application is a Windows Service made in C# .NET 2.0, wich make use of FileSystemWatcher to read the path \\machinecap\platform\in for files created and renamed.

I have "Full Control" permissions since \\machinecap\platform (including all sub-dirs), but only this, no access to any folder else in the server (is a Windows Server 2003).

The problem is that when a file arrives at the server, the service fall down, and no (descent) message is logged in Event Viewer. Trying to trace the problem, I made a loggon in the server and tried to run mannually all the steps that the application does. I can create files in the "in" folder, however I cannot delete these files... a error message is shown: "E:\ is not accessible. Access is denied."

Of course I don't have any access to E:\ root folder, only to E:\cappuccino\platform... is this the problem? Do I really have to give read access to E:\ in order I can read E:\cappuccino\platform?

MORE INFO

Exception message:

Unhandled Exception: System.BadImageFormatException: Could not load file or assembly 'Oracle.DataAccess, Version=2.112.2.0, Culture=neutral, PublicKeyToken=89b483f429c47342' or one of its dependencies.
An attempt was made to load a program with an incorrect format.
File name: 'Oracle.DataAccess, Version=2.112.2.0, Culture=neutral, PublicKeyToken=89b483f429c47342'
   at TestRiskStore.ArisReportReader.CreateOrRename(Object source, FileSystemEventArgs e)
   at System.IO.FileSystemWatcher.CompletionStatusChanged(UInt32 errorCode, UInt32 numBytes, NativeOverlapped* overlappedPointer)
   at System.Threading._IOCompletionCallback.PerformIOCompletionCallback(UInt32 errorCode, UInt32 numBytes, NativeOverlapped* pOVERLAP)

WRN: Assembly binding logging is turned OFF.
To enable assembly bind failure logging, set the registry value [HKLM\Software\Microsoft\Fusion!EnableLog] (DWORD) to 1.
Note: There is some performance penalty associated with assembly bind failure logging.
To turn this feature off, remove the registry value [HKLM\Software\Microsoft\Fusion!EnableLog].

Please note that I'm using Oracle.DataAccess component.. I think the problem is related to this, not sure.... any idea how to solve this problem?


Solution

  • I've found the problem: my machine is 32 bits, the server is 64 bits, and I was compiling the application to run on any platform. The problem is that the OracleDataAccess components that it was installed on the server is for 32 bits, so the assemblies were installed only on GAC_32 folder. Thus when the application try to run on 64 bits mode it doesn't find the assemblies.

    So I just recompiled the application as x86 (32 bits), and it worked. Now the application runs on 32 bit mode and it look for the assemblies in the correct folder.