Post a reply

Options
Add an Attachment

If you do not want to add an Attachment to your Post, please leave the Fields blank.

(maximum 10 MB; please compress large files; only common media, archive, text and programming file formats are allowed)

Options

Topic review

jshir

One other thing - I was able to figure out that this occurs when impersonating a user account (AliasAccount.BeginImpersonation). Another place where I am using WinSCP without impersonating is working. But this program has been using WinSCP with impersonation since 2014 without a problem, so I don't know why I have this problem now.
jshir

Re: UnauthorizedAccessException WinSCPConsoleEventRequest

I reproduced the error on Windows Server '19 and Windows 10. It's a .NET console application.
martin

Re: UnauthorizedAccessException WinSCPConsoleEventRequest

Where/how do you run your application?
jshir

UnauthorizedAccessException WinSCPConsoleEventRequest

Trying to upload to SFTP server. It fails to session.open with:
System.UnauthorizedAccessException: Access to the path 'WinSCPConsoleEventRequest_6212_39451090_247' is denied.

   at System.IO.__Error.WinIOError(Int32 errorCode, String maybeFullPath)
   at System.Threading.EventWaitHandle..ctor(Boolean initialState, EventResetMode mode, String name, Boolean& createdNew, EventWaitHandleSecurity eventSecurity)
   at WinSCP.ExeSessionProcess.TryCreateEvent(String name, EventWaitHandle& ev)
   at WinSCP.ExeSessionProcess.InitializeConsole()
   at WinSCP.ExeSessionProcess.Start()
   at WinSCP.Session.Open(SessionOptions sessionOptions)

I don't see anything denied in Procmon. The code worked previously but installing in new environment gave error. This session is created inside a .NET console application.