Topic "Message From server: 141 Can't open log file 'D:\\log.xml'"

Author Message
tdguitar
[View user's profile]

Joined: 2011-10-21
Posts: 1
Location: VIET NAM
Please help me to check this problem when logging the action by winscp from client.
I publish the sample code below in server:
Code:

        const string log_path = "log.xml";
        Process winscp = new Process();
        winscp.StartInfo.FileName = "C:\\program files\\winscp\\winscp.com ";       
        winscp.StartInfo.Arguments = "/log=D:\\" + log_path;
        winscp.StartInfo.UseShellExecute = false;
        winscp.StartInfo.RedirectStandardInput = true;
        winscp.StartInfo.RedirectStandardOutput = true;
        winscp.StartInfo.CreateNoWindow = true;
        winscp.Start();
        winscp.StandardInput.WriteLine("option batch abort");
        winscp.StandardInput.WriteLine("option confirm off");

        winscp.StandardInput.WriteLine("open mysession");
        winscp.StandardInput.WriteLine("ls ");
       
        winscp.StandardInput.Close();
        string output = winscp.StandardOutput.ReadToEnd();
        winscp.WaitForExit();

But the value of output is like that when I run from client:
winscp> option batch abort
batch abort
winscp> option confirm off
confirm off
winscp> open user:pass@ip_host
141 Can't open log file 'D:\\log.xml'.

And when I check on the hard disk D in server, there's no log file created. Please check and help me ASAP.
Advertisements
martin
[View user's profile]
Site Admin
Joined: 2002-12-10
Posts: 24993
Location: Prague, Czechia
Make sure the account that runs the script has write access to C:\
_________________
Martin Prikryl
Guest




I checked on the iis server that account have full access right. Please check for me that is there anything I need to check more?
The error message is " 141 Can't open log file D:\log.xml".

Thanks for reply.
Guest




Okie, I found out the problem. The problem is lacking add the permission for NETWORK_SERVICE.
Thanks for your support.
hinnman

Guest


The weird part is that it gives the 141 can't find log file, but it still writes to the log.

tom dot owens at yahoo dot com
martin
[View user's profile]
Site Admin
Joined: 2002-12-10
Posts: 24993
Location: Prague, Czechia
hinnman wrote:
The weird part is that it gives the 141 can't find log file, but it still writes to the log.

tom dot owens at yahoo dot com

Can you send me an email, so I can send you back a debug version of WinSCP to track the problem? Please include link back to this topic in your email. Also note in this topic that you have sent the email. Thanks.

You will find my address (if you log in) in my forum profile.
_________________
Martin Prikryl
Balaji

Guest


Still I am facing same error. As mentioned above i added network service account for my logs folder. Can anyone please please halp me asap. Thanks.

batch abort
winscp> option confirm off
confirm off
winscp> open sftp://xxUser@xxx.56.xxx.96:22 -privatekey="C:\FTP_Automation\privatekey.ppk"
141
Can't open log file '.\log\scpLog.xml'.
Searching for host...
Connecting to host...
martin
[View user's profile]
Site Admin
Joined: 2002-12-10
Posts: 24993
Location: Prague, Czechia
What is command-line you use to run WinSCP? What is startup directory of the command? What is a path to the log folder?
_________________
Martin Prikryl
Balaji

Guest


prikryl wrote:
What is command-line you use to run WinSCP? What is startup directory of the command? What is a path to the log folder?


Thanks for your quick reply.

Actually I prepared console application,if I run manually script is working fine. when i automate using windows task scheduler the problem is happening.

I have placed my .exe in following location in a server. C:\FTP_Automation\HRIQ_OTS_FTP. The logs will generate in following location. C:\FTP_Automation\HRIQ_OTS_FTP\logs\.
I have given full access permission as well as I added Network Service account to the "HRIQ_OTS_FTP" folder.

Below is my sample winscp code.

winscp = new Process();
winscp.StartInfo.FileName = ClientPath;
winscp.StartInfo.Arguments = "/log=" + ClientLog;
winscp.StartInfo.UseShellExecute = false;
winscp.StartInfo.RedirectStandardInput = true;
winscp.StartInfo.RedirectStandardOutput = true;
winscp.StartInfo.CreateNoWindow = true;
winscp.Start();
winscp.StandardInput.WriteLine("option batch abort");
winscp.StandardInput.WriteLine("option confirm off");
winscp.StandardInput.WriteLine(string.Format("open sftp://{0}@{1}:{2} -privatekey=\"{3}\"", HostUser, HostIP, HostPort, PrivateKey));
winscp.StandardInput.WriteLine(string.Format("StartInfo Argument {0}", winscp.StartInfo.Arguments.ToString()));
winscp.StandardInput.WriteLine(string.Format("cd {0}", HostRoot));
winscp.StandardInput.WriteLine(string.Format("lcd {0}", ClientRoot));
winscp.StandardInput.WriteLine("option transfer binary");

out put:
winscp> option confirm off
confirm off
winscp> open sftp://hriqftp@210.56.134.96:22 -privatekey="C:\FTP_Automation\HRIQFTPKeys\privatekey.ppk"
141
Can't open log file '.\log\scpLog.xml'.
Searching for host...
Connecting to host...
Authenticating...
Using username "hriqftp".
Authenticating with public key "rsa-key-201xxx22".
Authenticated.
martin
[View user's profile]
Site Admin
Joined: 2002-12-10
Posts: 24993
Location: Prague, Czechia
EXE location is not the same as startup/working directory. Try setting winscp.StartInfo.WorkingDirectory. Also try using absolute path to an INI file.
_________________
Martin Prikryl
Balaji

Guest


prikryl wrote:
EXE location is not the same as startup/working directory. Try setting winscp.StartInfo.WorkingDirectory. Also try using absolute path to an INI file.


Thank you very much Martin Prikryl. Its working fine after I set the winscp.StartInfo.WorkingDirectory= path of exe folder.

Once again Thank you very much. You saved lot of my time.

Regards,
Balaji
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