'The target account name is incorrect'-IOException DirectoryInfo.GetFiles

'The target account name is incorrect'-IOException with DirectoryInfo.GetFiles

我正在做这个并且之前是有效的:

var di = new DirectoryInfo("FolderOnSharedDrive");
var files = di.GetFiles("*");

我现在有这个异常,我能看到的唯一区别是我现在有 Windows 10。

Exception thrown: 'System.IO.IOException' in mscorlib.dll
Additional information: The target account name is incorrect.

尝试使用 IP 地址而不是计算机名称。

通过从网络中完全注销机器解决了问题。