UnauthorizedAccessException WinSCPConsoleEventRequest

Advertisement

jshir
Guest

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.

Reply with quote

Advertisement

jshir
Guest

Re: UnauthorizedAccessException WinSCPConsoleEventRequest

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

Reply with quote

jshir
Guest

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.

Reply with quote

Advertisement

You can post new topics in this forum