Timeout trying to connect from IIS/ASP

Advertisement

Xanrag
Joined:
Posts:
2
Location:
Sweden

Timeout trying to connect from IIS/ASP

I have a small section of code in VBA as follows:

Dim oSessionOptions, oSession

   Set oSessionOptions = WScript.CreateObject("WinSCP.SessionOptions")
   With oSessionOptions
      .Protocol = 0 'Protocol_Sftp
      .HostName = "10.112.5.148"
      .UserName = "ababab"
      .Password = "bababa"
      .SshHostKey = "ssh-rsa 1024 bc:96:db:86:fc:10:e4:00:45:21:5f:2f:a6:94:39:02"
   End With
   
   Set oSession = WScript.CreateObject("WinSCP.Session")

   oSession.DebugLogPath = "c:\logs\sftp-debug.log"
   oSession.SessionLogPath = "c:\logs\sftp.log"
   oSession.Open oSessionOptions
   
   oSession.Dispose
.. It works just fine when I run it as a vbscript file from the commandline. However when I try to run it in an ASP file (classic ASP) it gets a timeout. (After I replaced WScript with Server in the above code)

When it works the relevant debug log section looks like this:

[2012-07-11 21:32:01Z] [0003]     Scheduling output: [Starting the session...]
[2012-07-11 21:32:01Z] [0003]   ExeSessionProcess.ProcessEvent leaving
[2012-07-11 21:32:01Z] [0001]     Output: [Starting the session...]
[2012-07-11 21:32:01Z] [0003]   ExeSessionProcess.ProcessEvent entering
[2012-07-11 21:32:01Z] [0003]     Scheduling output: [Reading remote directory...]
[2012-07-11 21:32:01Z] [0003]   ExeSessionProcess.ProcessEvent leaving
[2012-07-11 21:32:01Z] [0001]     Output: [Reading remote directory...]
[2012-07-11 21:32:01Z] [0003]   ExeSessionProcess.ProcessEvent entering
[2012-07-11 21:32:01Z] [0003]     Scheduling output: [Session started.]
[2012-07-11 21:32:01Z] [0003]   ExeSessionProcess.ProcessEvent leaving
[2012-07-11 21:32:01Z] [0001]     Output: [Session started.]
[2012-07-11 21:32:01Z] [0003]   ExeSessionProcess.ProcessEvent entering
[2012-07-11 21:32:01Z] [0003]     Scheduling output: [Active session: [1] ababab@10.112.5.148]
[2012-07-11 21:32:01Z] [0003]   ExeSessionProcess.ProcessEvent leaving
[2012-07-11 21:32:01Z] [0001]     Output: [Active session: [1] ababab@10.112.5.148]
[2012-07-11 21:32:01Z] [0003]   ExeSessionProcess.ProcessEvent entering
[2012-07-11 21:32:01Z] [0003]   ExeSessionProcess.ProcessEvent leaving
[2012-07-11 21:32:01Z] [0003]   ExeSessionProcess.ProcessEvent entering
[2012-07-11 21:32:01Z] [0003]   ExeSessionProcess.ProcessEvent leaving
[2012-07-11 21:32:01Z] [0003]   ExeSessionProcess.ProcessEvent entering
[2012-07-11 21:32:01Z] [0003]     ExeSessionProcess.ProcessInputEvent entering
[2012-07-11 21:32:01Z] [0001]   CallstackAndLock..ctor leaving
[2012-07-11 21:32:01Z] [0001]   Result []
[2012-07-11 21:32:01Z] [0001] Session.System.Reflection.IReflect.InvokeMember leaving
[2012-07-11 21:32:01Z] [0001] Session.System.Reflection.IReflect.InvokeMember entering
[2012-07-11 21:32:01Z] [0001]   Name [Dispose]
[2012-07-11 21:32:01Z] [0001]   Target [WinSCP.Session]

And when it doesn't work it looks like this:
[2012-07-11 22:07:54Z] [0003]     Scheduling output: [Starting the session...]
[2012-07-11 22:07:54Z] [0003]   ExeSessionProcess.ProcessEvent leaving
[2012-07-11 22:07:54Z] [0003]   ExeSessionProcess.ProcessEvent entering
[2012-07-11 22:07:54Z] [0003]     Scheduling output: [Reading remote directory...]
[2012-07-11 22:07:54Z] [0003]   ExeSessionProcess.ProcessEvent leaving
[2012-07-11 22:07:54Z] [0003]   ExeSessionProcess.ProcessEvent entering
[2012-07-11 22:07:54Z] [0003]     Scheduling output: [Session started.]
[2012-07-11 22:07:54Z] [0003]   ExeSessionProcess.ProcessEvent leaving
[2012-07-11 22:07:54Z] [0003]   ExeSessionProcess.ProcessEvent entering
[2012-07-11 22:07:54Z] [0003]     Scheduling output: [Active session: [1] ababab@10.112.5.148]
[2012-07-11 22:07:54Z] [0003]   ExeSessionProcess.ProcessEvent leaving
[2012-07-11 22:07:54Z] [0003]   ExeSessionProcess.ProcessEvent entering
[2012-07-11 22:07:54Z] [0003]   ExeSessionProcess.ProcessEvent leaving
[2012-07-11 22:07:54Z] [0003]   ExeSessionProcess.ProcessEvent entering
[2012-07-11 22:07:54Z] [0003]   ExeSessionProcess.ProcessEvent leaving
[2012-07-11 22:07:54Z] [0003]   ExeSessionProcess.ProcessEvent entering
[2012-07-11 22:07:54Z] [0003]     ExeSessionProcess.ProcessInputEvent entering
[2012-07-11 22:08:54Z] [0001]     Exception: System.TimeoutException: Timeout waiting for WinSCP to respond.
   at WinSCP.Session.CheckForTimeout()
   at WinSCP.Session.Open(SessionOptions sessionOptions)
[2012-07-11 22:08:54Z] [0001]     Session.Cleanup entering
[2012-07-11 22:08:54Z] [0001]       Command: [exit]
[2012-07-11 22:08:54Z] [0001]       ExeSessionProcess.ExecuteCommand entering
[2012-07-11 22:08:54Z] [0001]       ExeSessionProcess.ExecuteCommand leaving
[2012-07-11 22:08:54Z] [0003]       Scheduling output: [winscp> exit]
[2012-07-11 22:08:54Z] [0003]     ExeSessionProcess.ProcessInputEvent leaving
[2012-07-11 22:08:54Z] [0003]   ExeSessionProcess.ProcessEvent leaving
[2012-07-11 22:08:54Z] [0001]       ExeSessionProcess.Close entering
[2012-07-11 22:08:54Z] [0001]       ExeSessionProcess.Close leaving
[2012-07-11 22:08:54Z] [0001]       ExeSessionProcess.Dispose entering
[2012-07-11 22:08:54Z] [0003] ExeSessionProcess.ProcessEvents leaving
[2012-07-11 22:08:54Z] [0001]       ExeSessionProcess.Dispose leaving
[2012-07-11 22:08:54Z] [0001]     Session.Cleanup leaving
[2012-07-11 22:08:54Z] [0001]   CallstackAndLock..ctor leaving
[2012-07-11 22:08:54Z] [0001]   Error [System.Reflection.TargetInvocationException: Exception has been thrown by the target of an invocation. ---> System.TimeoutException: Timeout waiting for WinSCP to respond.
   at WinSCP.Session.CheckForTimeout()
   at WinSCP.Session.Open(SessionOptions sessionOptions)
   --- End of inner exception stack trace ---
   at System.RuntimeMethodHandle._InvokeMethodFast(Object target, Object[] arguments, SignatureStruct& sig, MethodAttributes methodAttributes, RuntimeTypeHandle typeOwner)
   at System.RuntimeMethodHandle.InvokeMethodFast(Object target, Object[] arguments, Signature sig, MethodAttributes methodAttributes, RuntimeTypeHandle typeOwner)
   at System.Reflection.RuntimeMethodInfo.Invoke(Object obj, BindingFlags invokeAttr, Binder binder, Object[] parameters, CultureInfo culture, Boolean skipVisibilityChecks)
   at System.Reflection.RuntimeMethodInfo.Invoke(Object obj, BindingFlags invokeAttr, Binder binder, Object[] parameters, CultureInfo culture)
   at System.RuntimeType.InvokeMember(String name, BindingFlags bindingFlags, Binder binder, Object target, Object[] providedArgs, ParameterModifier[] modifiers, CultureInfo culture, String[] namedParams)
   at WinSCP.Session.System.Reflection.IReflect.InvokeMember(String name, BindingFlags invokeAttr, Binder binder, Object target, Object[] args, ParameterModifier[] modifiers, CultureInfo culture, String[] namedParameters)]
[2012-07-11 22:08:54Z] [0001] Session.System.Reflection.IReflect.InvokeMember leaving

Any tips on what I should look at? Permission for the account running IIS? COM rights etc?

The reason it is old classic ASP is that it is an old project that due to policy has to switch from FTP to SFTP and the old control does not support it.
Description: Put sftp.log from both runs here since max attachments was 3.

Reply with quote

Advertisement

martin
Site Admin
martin avatar
Joined:
Posts:
40,476
Location:
Prague, Czechia

Re: Timeout trying to connect from IIS/ASP

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.

Reply with quote

Xanrag
Joined:
Posts:
2
Location:
Sweden

I used the debug vertsion and mailed you the output, but it did not shed any light on the problem.

I didn't give up though and I found a way to make it work (although not quite an acceptable one in production). If I make both the IWAM_ and the IUSR_ accounts members of the administrators group the strange delay does not happen, so there must be some rights that the user is missing without it.

Reply with quote

Advertisement

You can post new topics in this forum