Cannot initialize external console



Cannot initialize external console

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();

//// 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

///// 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;

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.

Reply with quote



You can post new topics in this forum