Archived Forum Post

Index of archived forum posts

Question:

osErrorInfo: Access is denied. Failed to create output file on local filesystem.

Mar 12 '13 at 10:05

Dear esteemed Sirs/Madams,

I would like to ask you a question so I can hopefully fix a very weird problem.

We had the program (that makes a SFTP connection and downloads some files and processes them) running on a Windows Server 2003. We migrated the whole program to Windows 2008 R2. We had some issues, apparently running the scheduled task under Administrator account is not enough, you also need to give the IUSR group enough permissions. Anyway after a lot of effort and hard work, the program ran successfully. Now we have the problem that it is not working at all, we tried an IIS reset as that is the thing that worked the last time. Could anybody here please help me out and see if they know the fix?

2013-03-11 14:10:58  INFO  - Processing file : I_ExAcc_01032013_00060.csv
2013-03-11 14:10:58  ERROR - Download of file ./New/I_ExAcc_01032013_00060.csv failed. Error message: ChilkatLog:
  DownloadFileByName:
    DllDate: Feb 15 2010
    UnlockPrefix: YALLNLSSH
    Username: Administrator
    Component: .NET 2.0
    SshVersion: SSH-2.0-WingFTPserver
    SftpVersion: 3
    PreserveDate: 0
    fromFilePath: ./New/I_ExAcc_01032013_00060.csv
    toFilePath: ./Downloads/I_ExAcc_01032013_00060.csv
    OpenRemoteFile:
      filename: ./New/I_ExAcc_01032013_00060.csv
      access: readOnly
      createDisposition: openExisting
      v3Flags: 0x1
      Sent FXP_OPEN
      handle: 31202E2F4E65772F495F45784163635F30313033323031335F30303036302E637376
      SshLog: 
SFTP> Sending SSH_FXP_OPEN
TRAN> CHANNEL_DATA
TRAN* NumBytes: 53
TRAN< CHANNEL_DATA
SFTP< Received SSH_FXP_HANDLE

      timeToOpenMs: Elapsed time: 16 millisec
    FetchRemoteFileAttributes:
      filename: ./New/I_ExAcc_01032013_00060.csv
      Using FXP_STAT
      Sent message to fetch attributes.
      Received SSH_FXP_ATTRS
      unpackSftpVersion: 3
      octalPermissions: 100666
      timeToFetchAttrMs: Elapsed time: 31 millisec
    remoteFileSize: 150
    resumeFlag: 0
    Failed to open file (2)
    filename: .\Downloads\I_ExAcc_01032013_00060.csv
    currentWorkingDirectory: D:\webroot\extrafilmhelpsyou\website\Maatwerk\KlantImporter-Express-T5-v20120619
    osErrorInfo: Access is denied.
    Failed to create output file on local filesystem.
    Sent FXP_CLOSE
    StatusResponse:
      Request: FXP_CLOSE
      StatusCode: 0
      StatusMessage: 
    totalTimeMs: Elapsed time: 78 millisec
    Failed.

That is an excerpt of the logfile.


Answer

First, you are using an old build from Feb 2010, so I always recommend that you try the latest build (Dec 2012) and see if that fixes your problem.

Secondly, the error message is Access is Denied, which almost always indicates a permissions problem. Are you sure that the user account that your process is running under has permission to write to the D:webrootextrafilmhelpsyouwebsiteMaatwerkKlantImporter-Express-T5-v20120619 folder?


Answer

Unhandled Exception: System.TypeInitializationException: The type initializer fo
r 'KlantImporter_Express_T5.App_code.Program' threw an exception. ---> System.IO
.FileLoadException: Could not load file or assembly 'ChilkatDotNet2, Version=9.0
.8.0, Culture=neutral, PublicKeyToken=eb5fc1fc52ef09bd' or one of its dependenci
es. The located assembly's manifest definition does not match the assembly refer
ence. (Exception from HRESULT: 0x80131040)
File name: 'ChilkatDotNet2, Version=9.0.8.0, Culture=neutral, PublicKeyToken=eb5
fc1fc52ef09bd'
   at KlantImporter_Express_T5.App_code.SftpWrapper..ctor()
   at KlantImporter_Express_T5.App_code.Program..cctor()

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

Sadly the new version causes this.

The user running the account is Administrator. So that should be all right. UAC bug seems to be the culprit so far.

We ran it under the System account and it downloaded the files correctly. It could not process them as it was not allowed to make a connection to another server/website.

Tomorrow I know more. Also there seems to be another possible fix, something to do with rights on the task itself. I have to look into this more.

Anyway the fix for the Application pool user was not applicable, as it did not run under a application pool. :D

I will keep you all posted.