Topic "Cannot initialize external console"

Author Message
ssch
[View user's profile]

Joined: 2015-04-21
Posts: 4
Issue: When a web application hosted on W2K8 server environment, it is not uploading file to the linux server.

SNIPPET of the web page calling a webservice.

string host = ConfigurationManager.AppSettings["HOST"].ToString();
string user = ConfigurationManager.AppSettings["USER"].ToString();
string password = ConfigurationManager.AppSettings["PW"].ToString();
string hostkey = ConfigurationManager.AppSettings["KEY"].ToString();
string tempFilePath = ConfigurationManager.AppSettings["INFILE"].ToString();
string outFilePath = ConfigurationManager.AppSettings["OUTFILE"].ToString();

KillWinSCPProcesses("WinSCP");
//// create temporary input file out of input stream
File.WriteAllBytes(tempFilePath+fileName, inputStream);
FileInfo fi = new FileInfo(tempFilePath+fileName);
if (!fi.Exists)
throw new Exception("Failed to create input file.");
string fileFull = fi.FullName;
string fileNameWExt = fi.Name;
string fileExt = fi.Extension;
// open file upload session
Session session = openFileUploadSession(host, user, password, hostkey);

// upload the file
TransferOptions transferOptions = new TransferOptions();
transferOptions.TransferMode = TransferMode.Binary;
TransferOperationResult transferResult;
transferResult = session.PutFiles(tempFilePath+fileName, outFilePath+fileName, false, transferOptions);

// check upload status
transferResult.Check();



///// Snippet for OpenFileUploadsession

SessionOptions sessionOptions = new SessionOptions
{
Protocol = Protocol.Sftp,
HostName = "xxx",
UserName = "xxx",
Password = "xxx",
SshHostKeyFingerprint = "ssh-rsa 2048 xx:4c:xx:ef:2f:29:c0:62:b7:37:5c:xx:73:0a:xx:7b"
};
Session session = new Session()
session.DisableVersioncheck = true;
session.Open(sessionOptions);



I have capture all the Exeception in C# and it fails at session.OPEN(). It says "cannot initialize external console".
at WinSCP.ElementLogReader.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(SessionOtpions sessionOptions)


NOTE: Same code it works on my local machine with a VS2010...
I have build a simple Console app when i run on the hosted server it works fine as well.
martin
[View user's profile]
Site Admin
Joined: 2002-12-10
Posts: 24530
Location: Prague, Czechia
Duplicate post:
http://winscp.net/forum/viewtopic.php?t=15287
Advertisements

You can post new topics in this forum






Search Site

What is WinSCP?

It is award-winning SFTP client, SCP client, FTPS client and FTP client integrated into one software program for file transfer to FTP server or secure SFTP server. [More]

And it's free!

Donate

About donations

$9   $19   $49   $99

About donations

Recommend

WinSCP Privacy Policy

WinSCP License