gpt4 book ai didi

c# - Tamir.SharpSsh 无法加载文件或程序集 'DiffieHellman

转载 作者:太空狗 更新时间:2023-10-30 00:51:43 29 4
gpt4 key购买 nike

private void OVConnection()
{
try {
//Create a new JSch instance
JSch jsch = new JSch();

this.Dispatcher.BeginInvoke(new Action<Status>(DisplayStatus), Status.Connecting);
//Create a new SSH session
string host = "url"; //url
string user = "***"; //ssh username
string pass = "*******"; //ssh password
int sshPort = 22; //ssh port
int rPort = 3306;
int lPort = 3306;

int port = Convert.ToInt32(sshPort);

session = jsch.getSession(user, host, port);
session.setHost(host);
session.setPassword(pass);

UserInfo ui = new MyUserInfo();
session.setUserInfo(ui);

session.connect();

//Set port forwarding on the opened session
session.setPortForwardingL(lPort, "localhost", rPort);

if (session.isConnected()) {
MyDatabase();
}
}
catch (Exception ex) {
MessageBox.Show(ex.Message);
this.Dispatcher.BeginInvoke(new Action<Status>(DisplayStatus), Status.NotConnected);
}
}

我得到:

Session.connect: System.IO.FileNotFoundException: Could not load file or assembly 'DiffieHellman, Version=0.0.0.0, Culture=neutral, PublicKeyToken=null' or one of its dependencies. The system cannot find the file specified.

File name: 'DiffieHellman, Version=0.0.0.0, Culture=neutral, PublicKeyToken=null'
at Tamir.SharpSsh.jsch.jce.DH.getE()
at Tamir.SharpSsh.jsch.DHG1.init(Session session, Byte[] V_S, Byte[] V_C, Byte[] I_S, Byte[] I_C)
at Tamir.SharpSsh.jsch.Session.receive_kexinit(Buffer buf)
at Tamir.SharpSsh.jsch.Session.connect(Int32 connectTimeout)

=== Pre-bind state information ===

LOG: DisplayName = DiffieHellman, Version=0.0.0.0, Culture=neutral, PublicKeyToken=null
(Fully-specified)
LOG: Appbase = file:///C:/Development/2013/OV Projects/OmniView Documents Upload/Documents Upload/bin/Debug/
LOG: Initial PrivatePath = NULL
Calling assembly : Tamir.SharpSSH, Version=1.1.1.13, Culture=neutral, PublicKeyToken=null.

===

LOG: This bind starts in default load context.
LOG: Using application configuration file: C:\Development\2013\OV Projects\OmniView Documents Upload\Documents Upload\bin\Debug\Documents Upload.vshost.exe.Config
LOG: Using host configuration file:
LOG: Using machine configuration file from C:\Windows\Microsoft.NET\Framework\v4.0.30319\config\machine.config.
LOG: Policy not being applied to reference at this time (private, custom, partial, or location-based assembly bind).
LOG: Attempting download of new URL file:///C:/Development/2013/OV Projects/OmniView Documents Upload/Documents Upload/bin/Debug/DiffieHellman.DLL.
LOG: Attempting download of new URL file:///C:/Development/2013/OV Projects/OmniView Documents Upload/Documents Upload/bin/Debug/DiffieHellman/DiffieHellman.DLL.
LOG: Attempting download of new URL file:///C:/Development/2013/OV Projects/OmniView Documents Upload/Documents Upload/bin/Debug/DiffieHellman.EXE.
LOG: Attempting download of new URL file:///C:/Development/2013/OV Projects/OmniView Documents Upload/Documents Upload/bin/Debug/DiffieHellman/DiffieHellman.EXE.

我不明白为什么。

最佳答案

我有同样的错误,可以通过添加 this NuGet package 来解决它来自 Mentalis到我的项目引用。

确保您拥有 NuGet package manager安装,首先。安装后,我这样做了:

右键单击 References > Manage nuget packages > 搜索 DiffieHellman > Install

这对我有用。

关于c# - Tamir.SharpSsh 无法加载文件或程序集 'DiffieHellman,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/25382251/

29 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com