SSH.NET icon indicating copy to clipboard operation
SSH.NET copied to clipboard

Server identification problem in NETStandart 2.0

Open Kutikov opened this issue 8 years ago • 55 comments

Renci.SshNet.Common.SshConnectionException: "Server response does not contain SSH protocol identification." - VS 2017, causes only using UWP with NETStandart 2.0, but on UWP with NETCore there were no problems. After 2,5 hours of testing I`ve found out that problem is in timeouts of Session/ Could you fix it up?

Kutikov avatar Jan 21 '18 21:01 Kutikov

Can you provide more information? Do you have a small application (source) that allows me to reproduce this issue?

What version of SSH.NET are you using?

drieseng avatar Jan 21 '18 21:01 drieseng

I've got small server and I'm trying to access using code: SshClient sshClient = new SshClient(host, account, password); sshClient.Connect(): While minTarget version was 10.240, all works like a charm, but for using dotnetzip library I've changed minTarget version to FallCreatorsUpdate. As a result your library switchs from UAP10 version to NET 4.6.1 version and begins to reproduce this error. I haven't managed to debug your code, but I've found, that in Connect method in Session.cs there is some lines, that checks Ssh version after timeout. Maybe probleme placed there. You can reproduce that buf itself, using that code below and switching minTarget platform in UWP C# application in VS2017. It's important not to catch Renci.SshNet.Common.SshConnectionException and try to connect.

I use 2016.1.0 version.

Kutikov avatar Jan 21 '18 22:01 Kutikov

Why do you mention .NET Standard 2.0 in the issue? We do not yet ship a .NET Standard 2.0 version. Did you mean .NET Standard 1.3?

drieseng avatar Jan 21 '18 23:01 drieseng

I am experiencing this issue too, I'm using 2016.1.0 from NuGet, and building a UWP app against Fall Creators Update. I get failed SFTP connections on both my Linux server and Mac server. Both work fine with my other SFTP clients.

Version 2013.4.7 from NuGet doesn't have the problem, but I don't really want to drop back to such and old version.

theescapers avatar Jan 22 '18 01:01 theescapers

Sorry, maybe I made a mistake and an issue caused by .NET Standart 1.3. Could you reproduce this issue?

Kutikov avatar Jan 22 '18 06:01 Kutikov

For me version 2013.4.7 produced Renci.SshNet.Common.SshConnectionException: "An established connection was aborted by the software in your host machine." Is there any way to make UAP only library to fix isssue NU1701 Package 'SSH.NET 2016.1.0' was restored using '.NETFramework,Version=v4.6.1' instead the project target framework '.NETCoreApp,Version=v2.0'. This may cause compatibility problems.

Kutikov avatar Jan 22 '18 19:01 Kutikov

@Kutikov Won't have time today. I'll try to test it tomorrow.

drieseng avatar Jan 22 '18 21:01 drieseng

So is it any progress? If you don`t find out issue now, could you please build separated .NETCore SSH.NET for us to using it, while this issue would be fixed?

Kutikov avatar Jan 25 '18 20:01 Kutikov

Sorry too busy at work. Hope to have time this weekend.

drieseng avatar Jan 25 '18 21:01 drieseng

I have encontered the same issue when connect sshclient, it throwing the exception: Server response does not contain SSH protocol identification my environment is: Windows10 Fall Creators Update (Build 16299) SDK VS2017 SSH.NET v2016.1.0 So what I found the problems is: In Fall Creators Update and VS2017, the new UWP project will use .NETCore 2.0, which not be supported in current version. You can try: Downgrade the Microsoft.NETCore.UniversalWindowsPlatform in nugget package control panel from 6.x to 5.x. Which will use .NETCore 1.7 or eariler. @theescapers

ghost avatar Feb 02 '18 14:02 ghost

"Server response does not contain SSH protocol identification"

Connecting from:

  • Server 2012
  • .NET CLR 4.6.1

I connect to my linux s/FTP servers fine but when attempting to connect to:

  • Server 2008r2
  • Windows s/FTP server

I am using simple username + password authentication.

Is there some setting or code snippet that I can use to force compatibility?

I found the message in source in session.cs [612], is there a possible variation in the RegEx that should be considered?

stuwilliams-clgx avatar Mar 26 '18 18:03 stuwilliams-clgx

Are you sure the 2008R2 is SSH/SFTP? The built in FTP server is FTP/FTPS(over SSL) and that is a nother protocol not SSH based

Sent from my iPhone

On Mar 26, 2018, at 2:03 PM, Stuart Williams (Magenic) [email protected] wrote:

"Server response does not contain SSH protocol identification"

Connecting from:

Server 2012 .NET CLR 4.6.1 I connect to my linux s/FTP servers fine but when attempting to connect to:

Server 2008r2 Windows s/FTP server I am using simple username + password authentication.

Is there some setting or code snippet that I can use to force compatibility?

I found the message in source in session.cs [612], is there a possible variation in the RegEx that should be considered?

— You are receiving this because you are subscribed to this thread. Reply to this email directly, view it on GitHub, or mute the thread.

darkoperator avatar Mar 26 '18 19:03 darkoperator

@lyzl Was looking for a fix for a while and downgrading worked great to get it working on Build 16299, thanks!

KWinston avatar Apr 07 '18 01:04 KWinston

@Kutikov @theescapers @lyzl Can any of you still consistently reproduce this issue?

drieseng avatar Jul 21 '18 08:07 drieseng

@drieseng, at this moment I can't check up functionality due to not using UWP and .NET Standart 1.3

Kutikov avatar Jul 23 '18 05:07 Kutikov

hello, @drieseng , I reproduce. UWP project with XAMARIN.FORMS WINDOWS 10,Version 1803 (10.0 ; Build 17134) .NET Standard 2.0 , NuGet SSH.NET v2016.1.0

doodz avatar Aug 31 '18 08:08 doodz

I reproduce on 10% of our integration builds. Not consistently NetCore 2.1 on win10 & server2016 Last ssh.net nuget version + Syncplify server

rducom avatar Sep 10 '18 21:09 rducom

Experiencing the same issue in my UWP app. It works when I have set build 10240/14393/15063 as min target version and it stops working as soon as I set the min target version to build 16299/17134.

tipa avatar Oct 01 '18 08:10 tipa

Also receiving this error in .NET Core 2.1 on CentOS. Doesn't happen on all sftp connections... just one that I know of so far. Will see if I can gather some useful details later.

mbuchok avatar Oct 24 '18 20:10 mbuchok

Experiencing this issue too in UWP app on Windows IoT Core on raspberry pi 3 model b - and unfortunately, it is occurs in the critical function of the project

nick-goloborodko avatar Nov 15 '18 01:11 nick-goloborodko