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

martin

Re: SessionRemoteException: Cannot initialize external console

This issue has been added to the tracker:
https://winscp.net/tracker/1334
martin

I was able to reproduce the problem.
I will try to fix it.
martin

Thanks. I'll try to set this up.
xdu17

Hello prikryl,

In IIS, you can configure web.config file with option :
<identity impersonate="true" />

In this case, the user that runs .NET application is not the service account user used by IIS application pool, but another user, often the user identified by website. I know that this "impersonation" is not exactly what Windows does with the "runas" command. For example, user environment is not loaded...

MSDN says that about impersonation :
https://learn.microsoft.com/en-us/previous-versions/dotnet/netframework-3.0/xh507fc5(v=vs.85)
and for ACL on impersonate .NET programs :
https://learn.microsoft.com/en-us/previous-versions/kwzs111e(v=vs.140)

Thank you for your help
martin

Re: SessionRemoteException: Cannot initialize external console

Thanks for the details.
Can you guide me how to setup the "impersonated user environment"?
xdu17

Re: SessionRemoteException: Cannot initialize external console

Hi,

I've got the same problem with IIS .NET, but only in an impersonate user environment (works fine without impersonation). BTW, DebugLogPath file with the "Cannot initialize external console" is generated only if the XmlLogPath is set.

Without XmlLogPath :

[2015-05-21 15:12:06.319Z] [0007] E:\ECMHomedir\bin\WinSCP.exe - exists [True]
[2015-05-21 15:12:06.319Z] [0007] Exception: WinSCP.SessionLocalException: WinSCP process terminated with exit code 0 and output "", without responding (response log file C:\Windows\TEMP\wscp11D4.0324493A.tmp was not created). This could indicate lack of write permissions to the log folder or problems starting WinSCP itself.
[2015-05-21 15:12:06.319Z] [0007] Exception: WinSCP.SessionLocalException: WinSCP process terminated with exit code 0 and output "", without responding (response log file C:\Windows\TEMP\wscp11D4.0324493A.tmp was not created). This could indicate lack of write permissions to the log folder or problems starting WinSCP itself.
at WinSCP.Session.Open(SessionOptions sessionOptions)
[2015-05-21 15:12:06.335Z] [0007] Session.Cleanup entering
[2015-05-21 15:12:06.335Z] [0007] Terminating process

With XmlLogPath :

[2015-05-21 15:13:34.134Z] [000a] ExeSessionProcess.InitializeChild entering
[2015-05-21 15:13:34.134Z] [000a] Starting "E:\ECMHomedir\bin\WinSCP.exe" /xmllog="E:\ECMHomedir\App_Data\Log\WinSCPXMLLog.log" /xmlgroups /nointeractiveinput /dotnet=571 /ini=nul /log="E:\ECMHomedir\App_Data\Log\WinSCPLog.log" /console /consoleinstance=_4564_63130991_611
[2015-05-21 15:13:34.134Z] [000a] Started process 1088
...
[2015-05-21 15:13:34.353Z] [000a] Log contents:
<?xml version="1.0" encoding="UTF-8"?>
<session xmlns="https://winscp.net/schema/session/1.0" name="nosession" start="2015-05-21T13:13:34.274Z">
<failure>
<message>Cannot initialize external console.</message>
</failure>
</session>
...
[2015-05-21 15:13:34.353Z] [000a] Read node 8: Text Cannot initialize external console.
[2015-05-21 15:13:34.353Z] [000a] Log contents has not changed
[2015-05-21 15:13:34.353Z] [000a] SessionLogReader.Read leaving
[2015-05-21 15:13:34.353Z] [000a] SessionLogReader.Read entering
[2015-05-21 15:13:34.353Z] [000a] Read node 9: EndElement message
[2015-05-21 15:13:34.353Z] [000a] Log contents has not changed
[2015-05-21 15:13:34.353Z] [000a] SessionLogReader.Read leaving
[2015-05-21 15:13:34.353Z] [000a] SessionLogReader.Read entering
[2015-05-21 15:13:34.353Z] [000a] Read node 10: Whitespace

[2015-05-21 15:13:34.353Z] [000a] Log contents has not changed
[2015-05-21 15:13:34.368Z] [000a] SessionLogReader.Read leaving
[2015-05-21 15:13:34.368Z] [000a] SessionLogReader.Read entering
[2015-05-21 15:13:34.368Z] [000a] Read node 11: EndElement failure
[2015-05-21 15:13:34.368Z] [000a] Log contents has not changed
[2015-05-21 15:13:34.368Z] [000a] SessionLogReader.Read leaving
[2015-05-21 15:13:34.368Z] [000a] Exception: WinSCP.SessionRemoteException: Cannot initialize external console.
[2015-05-21 15:13:34.368Z] [000c] Process 1088 exited with exit code 0
[2015-05-21 15:13:34.368Z] [000c] Exited
[2015-05-21 15:13:34.368Z] [000c] ExeSessionProcess.ProcessEvents leaving
[2015-05-21 15:13:34.368Z] [000a] ElementLogReader.Dispose entering
[2015-05-21 15:13:34.368Z] [000a] ElementLogReader.ReadToEnd entering
[2015-05-21 15:13:34.368Z] [000a] ElementLogReader.ReadToEnd leaving
[2015-05-21 15:13:34.368Z] [000a] ElementLogReader.Dispose leaving
[2015-05-21 15:13:34.368Z] [000a] Failed: [WinSCP.SessionRemoteException: Cannot initialize external console.]
[2015-05-21 15:13:34.368Z] [000a] SessionLogReader.Read leaving
[2015-05-21 15:13:34.368Z] [000a] Exception: WinSCP.SessionRemoteException: Cannot initialize external console.
at WinSCP.SessionLogReader.Read(LogReadFlags flags)
at WinSCP.ElementLogReader.Read(LogReadFlags flags)
at WinSCP.SessionElementLogReader.Read(LogReadFlags flags)
at WinSCP.CustomLogReader.TryWaitForNonEmptyElement(String localName, LogReadFlags flags)
at WinSCP.CustomLogReader.WaitForNonEmptyElement(String localName, LogReadFlags flags)
at WinSCP.CustomLogReader.WaitForGroupAndCreateLogReader()
at WinSCP.Session.Open(SessionOptions sessionOptions)
[2015-05-21 15:13:34.368Z] [000a] Session.Cleanup entering
[2015-05-21 15:13:34.368Z] [000a] Terminating process
[2015-05-21 15:13:34.368Z] [000a] Command: [exit]

Hope this help !
martin

Re: SessionRemoteException: Cannot initialize external console

This issue has been added to the tracker:
https://winscp.net/tracker/1317
ssch

hello prikryl Can you please also send me the email with the same fix info. I am expeerienceing the same issue. And i have posted a blog. too.
martin

Thanks for your report.
I have sent you an email with a development version of WinSCP to address you have used to register on this forum.
jono06

Hi, I am currently having the same problem. I receive a "Cannot initialize external console." error when attempting to use the automation library through an IIS asp.net web site.
martin

Re: SessionRemoteException: Cannot initialize external console

Thanks for your report.
I have sent you an email with a debug version of WinSCP to address you have used to register on this forum.
diegopolanco

SessionRemoteException: Cannot initialize external console

Hi. I have a problem when i use WinSCP .NET Assembly and i try to connect to SFTP Server, the error is WINSCP.SessionRemoteException: Cannot initialize external console . I attach DebugLog.log. Thanks for your help.