Thanks Martin for the reply, my actual issue is this,
I have a Windows service installed as (Logon as
Network Service
).
Spawn a thread and using Impersonation (username:
someuser
), invoke a method to FTP files that uses WINSCPNet.dll code.
1. I get the following error in this case
[0013] Waiting for request event
[0008] Exception: System.TimeoutException: Timeout waiting for WinSCP to respond - WinSCP has not responded in time, There was no output.Response log file \\xyz.com\abc\winscp_log.xml was not created. This could indicate lack of write permissions to the log folder or problems starting WINSCP itself.
at WINSCP.Session.CheckForTimeout(String additional)
at WINSCP.Session.Open(SessionOptions sessionOptions)
[0008] Session.Cleanup entering
[0008] Terminating process
2. Along with Impersonation, I tried assigning same value to
ExecutableProcessUsername
(
someuser
) and
ExecutableOrocessPassword
ExeSessionProcess.InittializeConsole entering
[0008] Trying event _2832_508747780_879
[0008] Creating event WinSCPCOnsoleEvent_2832_50874780_879
[0008] Created event WinSCPCOnsoleEvent_2832_50874780_879 with handle 1568 with security D:(A;;0X1f0003;;;S-1-5-21-1454471165-2077806209-1801674531-9593873), new True
[0008] Event _2832_50874780_879 is unique
[0008] Creating event WinSCPCOnsoleEvent_2832_50874780_879
[0008] Created event WinSCPCOnsoleEvent_2832_50874780_879 with handle 1832 with security D:(A;;0X1f0003;;;S-1-5-21-1454471165-2077806209-1801674531-9593873), new True
[0008] Creating event WinSCPCOnsoleEvent_2832_50874780_879
[0008] Created event WinSCPCOnsoleEvent_2832_50874780_879 with handle 732 with security D:(A;;0X1f0003;;;S-1-5-21-1454471165-2077806209-1801674531-9593873), new True
[0008] Acquiring communication structure
[0008] Acquired communication structure
[0008] Releasing communication structure
[0008] Released communication structure
[0008] Job Created
[0008] Job set to kill all processes
[0008] ExeSessionProcess.InitializeConsole leaving
[0008] ExeSessionProcess.InitializeChild entering
[0008] Will run process as someuser@domain
[0008] Granting access to window station
[0008] Granting access to desktop
[0008] Starting "D:\Apps\SSH Tools\WinSCP.exe" /xmllog="\\xyz.com\abc\winscp_log.xml" /xmlgroups /xmllogrequired /nointeractiveinput /dotnet=595 /ini=null /log="\\xyz.com\abc\winscp_session.xml" /loglevel=1 /console/consoleinstance=_2832_50874780_879
[0008] ExeSessionProcess.InitializeChild leaving
[0008] ExeSessionProcess.Start leaving
[0008] Exception: System.ComponentModel.Win32Exception (0X80004005): Access is denied
at System.Diagnostics.Process.StartWithCreateProcess(ProcessStartInfo startInfo)
at WinSCP.ExeSessionProcess.InitializeChild()
at WinSCP.ExeSessionProcess.Start()
at WinSCP.Session.Open(SessionOptions sessionOptions)
3. If I install Windows Service as (
someuser
), everything works fine
Looks like WinSCP.exe is still getting invoked as network service and not the provided credentials of
ExecutableProcessUsername
(someuser) and
ExecutableOrocessPassword
.
Appreciate your input to get impersonation working.