【发布时间】:2020-06-16 18:16:47
【问题描述】:
我尝试从其他 Windows 机器连接到 Windows 共享。 经过长时间的搜索,我找到了 sharpcifsstd.dobes.jp,但我无法让这些示例正常工作。
我收到了SharpCifs.Smb.SmbException: 'Failed to connect, IOException: transport closed in negotiate
我尝试了几个例子。
//Get the SmbFile specifying the file name to be created.
var auth1 = new NtlmPasswordAuthentication("username","password");
var file = new SmbFile("smb://10.50.15.91/d/NewFileName.txt",auth1);
//Create file.
file.CreateNewFile();
//Get writable stream.
var writeStream = file.GetOutputStream();
//Write bytes.
writeStream.Write(Encoding.UTF8.GetBytes("Hello!"));
//Dispose writable stream.
writeStream.Dispose();
我可以使用 Windows 资源管理器连接到 Windows 共享。
有没有人解决这个问题?或其他连接到 Windows 共享的方法?
【问题讨论】:
-
您找到解决方案了吗?
-
O 是的,我最终使用 net.exe 创建网络驱动器。
-
很公平。遇到这个问题后,我也放弃了 SharpCifs。感谢您发布您的答案!