.NET Error

Advertisement

joelignall
Joined:
Posts:
10
Location:
Work

.NET Error

Hello,

We are moving from Windows Server 2003 to Windows Server 2012. We are running the same .NET version (ver 2.0) and the same WinSCP version ver 5.0.8. The WinSCP.dll file was copied to the Microsoft.NET\Framework\<version>\ folder and the RegAsm.exe WinSCP.dll /codebase /tlb was ran successfully. However we are still getting the same error message (below) we ran before running the above steps. Any help would be greatly appreciated. Thanks!!!


System.ComponentModel.Win32Exception (0x80004005): The system cannot find the file specified at System.Diagnostics.Process.StartWithCreateProcess(ProcessStartInfo startInfo) at System.Diagnostics.Process.Start() at Login.UnixServer_UserLoginAuthorization() in D:\iALPSProject\Login.aspx.vb:line 342System.InvalidOperationException: StandardIn has not been redirected. at System.Diagnostics.Process.get_StandardInput() at Login.UnixServer_UserLoginAuthorization() in D:\iALPSProject\Login.aspx.vb:line 347

Reply with quote E-mail

Advertisement

martin
Site Admin
martin avatar
Joined:
Posts:
41,392
Location:
Prague, Czechia

Re: .NET Error

We do not know what your UnixServer_UserLoginAuthorization is doing.

It looks like it's starting some process (wincp.exe?).
So I assume you are not using the WinSCP .NET assembly (winscp.dll).

Reply with quote

Guest

Thank you very much, I updated the web.config file to point to "C:\Program Files (x86)\WinSCP\WinSCP.com". The application now hangs when trying to log in. Any suggestions would be appreciated. I am not a web developer so I may be missing something.

Reply with quote

Guest

Re: .NET Error

Hi Again,
We are hanging on the bit of code below. When we run the same code in windows 2003 we can see that winscp.exe and winscp.com start in the task manager and then they exit. But that does not happen in windows 2012 - we can see winscp.exe start but it’s just stuck in the task manager without exiting. It hangs at sftpProcess.WaitForExit()

Dim userOpenSessionString = "open sftp://" & oIalpsSession.UserID.ToString & ":" & oIalpsSession.Password.ToString & "@" & oIalpsSession.Machine.ToString _
& " -hostkey=" & Chr(34) & oIalpsSession.UnixSshHostKey.ToString & Chr(34)
Dim sftpProcess As Process = New Process()
Try
With sftpProcess.StartInfo
.FileName = WinSCPFileName.ToString
.UseShellExecute = False
.RedirectStandardInput = True
.RedirectStandardOutput = True
.CreateNoWindow = True
End With
Try
sftpProcess.Start()
Catch ex As Exception
Response.Write(ex.ToString)
End Try
With sftpProcess.StandardInput
.WriteLine(userOpenSessionString)
.WriteLine("exit")
.Close()
End With

sftpProcess.WaitForExit()

Dim processE(x)itCode = sftpProcess.ExitCode

If process(E)xitCode = 0 Then
sessionOpen = True
Else
sessionOpen = False
End If

Catch ex As Exception
Response.Write(ex.ToString)
sessionOpen = False
End Try

sftpProcess.Close()
sftpProcess.Dispose()

Thanks for your time, Joel

Reply with quote

martin
Site Admin
martin avatar

Re: .NET Error

Add /log=logpath to the WinSCP command-line and show us the log.

Or even better, use WinSCP .NET assembly instead of running WinSCP manually.

Reply with quote

Advertisement

Advertisement

You can post new topics in this forum