c# – Tamir.SharpSsh无法加载文件或程序集’DiffieHellman
内容导读
互联网集市收集整理的这篇技术教程文章主要介绍了c# – Tamir.SharpSsh无法加载文件或程序集’DiffieHellman,小编现在分享给大家,供广大互联网技能从业者学习和参考。文章包含3091字,纯文字阅读大概需要5分钟。
内容图文
![c# – Tamir.SharpSsh无法加载文件或程序集’DiffieHellman](/upload/InfoBanner/zyjiaocheng/818/09d81251de0b40dbbc3c90b1ae4476d4.jpg)
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.
我无法弄清楚为什么.
解决方法:
我有同样的错误,并能够通过从Mentalis添加this NuGet package到我的项目参考来解决它.
确保首先安装了NuGet package manager.安装后,我这样做了:
右键单击引用>管理nuget包>搜索DiffieHellman>安装
这对我有用.
内容总结
以上是互联网集市为您收集整理的c# – Tamir.SharpSsh无法加载文件或程序集’DiffieHellman全部内容,希望文章能够帮你解决c# – Tamir.SharpSsh无法加载文件或程序集’DiffieHellman所遇到的程序开发问题。 如果觉得互联网集市技术教程内容还不错,欢迎将互联网集市网站推荐给程序员好友。
内容备注
版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 gblab@vip.qq.com 举报,一经查实,本站将立刻删除。
内容手机端
扫描二维码推送至手机访问。