Put Files not working in Amazon AWS server.

Advertisement

ramakrishna
Joined:
Posts:
7
Location:
india

Put Files not working in Amazon AWS server.

Hi, Team,

Getting session log out and put files not working in Amazon AWS server. But, its working fine in Local.
I am using 5.9.6 version.

Below is my code

SessionOptions sessionOptions = new SessionOptions
{
Protocol = WinSCP.Protocol.Sftp,
HostName = "sftp.XXXXXX.com",
PortNumber = 22,
UserName = "XXXXXXXXX",
Password = "XXXXXXXXXX",
SshHostKeyFingerprint = "XXX-XXa 1098 xx:xx:xx:xx:xxx:xxx:xx:xx:xx:",
};

using (Session session = new Session())
{
// Connect
session.Open(sessionOptions);

// Your code
}
session.DebugLogPath = Server.MapPath("Temp/") + "logWinSCP";
session.Open(sessionOptions);

// Upload files
TransferOptions transferOptions = new TransferOptions();
transferOptions.TransferMode = TransferMode.Binary;

TransferOperationResult transferResult = null;
transferResult = session.PutFiles(Server.MapPath("Temp/" + _fileName), "/users/adminTest/sample/", false, transferOptions);

// Throw on any error
transferResult.Check();


Thanks,
Ram

Reply with quote

Advertisement

ramakrishna
Joined:
Posts:
7
Location:
india

Re: Put Files not working in Amazon AWS server.

Thanks for the response Martin,

In a server when I'm trying to connect FTP box with WINScp client, I'm able to connect and get and put files. But on the same server when I'm trying to put files using WINSCP .net assembly, I'm getting connection timed out the issue.

I thought like it may be the firewall which blocks but in that scenario, I should not connect to FTP box with WINSCP client also.

Could you please let me know what could be the problem?

for your reference.
Below is my code

SessionOptions sessionOptions = new SessionOptions
{
Protocol = WinSCP.Protocol.Sftp,
HostName = "sftp.XXXXXX.com",
PortNumber = 22,
UserName = "XXXXXXXXX",
Password = "XXXXXXXXXX",
SshHostKeyFingerprint = "XXX-XXa 1098 xx:xx:xx:xx:xxx:xxx:xx:xx:xx:",
};

using (Session session = new Session())
{
// Connect
session.Open(sessionOptions);

// Your code
}
session.DebugLogPath = Server.MapPath("Temp/") + "logWinSCP";
session.Open(sessionOptions);

// Upload files
TransferOptions transferOptions = new TransferOptions();
transferOptions.TransferMode = TransferMode.Binary;

TransferOperationResult transferResult = null;
transferResult = session.PutFiles(Server.MapPath("Temp/" + _fileName), "/users/adminTest/sample/", false, transferOptions);

// Throw on any error
transferResult.Check();

Thanks,
Rahul.

Reply with quote

martin
Site Admin
martin avatar
Joined:
Posts:
27,253
Location:
Prague, Czechia

Re: Put Files not working in Amazon AWS server.

We need log files! Both from GUI and the code.
And note that FTP is not SFTP. You are confusing those two.

Reply with quote

ramakrishna
Joined:
Posts:
7
Location:
india

Re: Put Files not working in Amazon AWS server.

Hi,

Please find the attached log file of GUI, from code, the log file is not generating (it's saying session timeout).
I am using SFTP not FTP its typing issue.


Thanks,
Rahul.
  • sftp.XXXXXX.com.log (20 KB, Private file)
Description: GUI Log file.

Reply with quote

ramakrishna
Joined:
Posts:
7
Location:
india

Re: Put Files not working in Amazon AWS server.

martin wrote:

We need log files! Both from GUI and the code.
And note that FTP is not SFTP. You are confusing those two.

Hi Martin, Waiting for your replay.

Thanks,
Ram.

Reply with quote

ramakrishna
Joined:
Posts:
7
Location:
india

Re: Put Files not working in Amazon AWS server.

martin wrote:


Hi, Thanks for your reply.

I tried with

session.ExecutableProcessUserName = "XXXX";
session.ExecutableProcessPassword="XXXXXX";

Error message changed and now I am getting
"System.ComponentModel.Win32Exception (0x80004005): Access is denied" error.

and I changed IIS impersonation permissions levels also still I am facing the same issue.

Thanks,
Rahul.

Reply with quote

martin
Site Admin
martin avatar
Joined:
Posts:
27,253
Location:
Prague, Czechia

Re: Put Files not working in Amazon AWS server.

Without an exception callstack, it's difficult to tell what causes the problem.
Where do you have winscp.exe stored? Does the local account have permissions to that file?

Reply with quote

Advertisement

You can post new topics in this forum