vb.net 跨网络访问文件失败,并显示“系统检测到可能危害安全的尝试”。
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/14658242/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
Accessing file across network fails with "The system detected a possible attempt to compromise security."
提问by TripleAntigen
Hi I am writing a WPF app that needs to access my files on another PC on my network (domain). My first try to access a remote folder has not been a raging success.
嗨,我正在编写一个 WPF 应用程序,它需要访问我网络(域)上另一台 PC 上的文件。我第一次尝试访问远程文件夹并没有取得巨大的成功。
On my Windows 7 laptop I entered in Windows Explorer
在我的 Windows 7 笔记本电脑上,我在 Windows 资源管理器中输入
\\WIN-DCname\c$
\\WIN-DCname\c$
, this is the path to C drive on my test domain controller, and when challenged I logged in with the administrator account for the DC. I can then access the folder tree of C drive as expected.
,这是我的测试域控制器上 C 盘的路径,当遇到挑战时,我使用 DC 的管理员帐户登录。然后我可以按预期访问 C 驱动器的文件夹树。
As a test application I used the following to probe that same drive:
作为测试应用程序,我使用以下内容来探测同一个驱动器:
Try
Dim DirInfo As New DirectoryInfo("\WIN-DCname\c$")
Dim Dirs = DirInfo.GetDirectories.OrderByDescending(Function(x) x.FullName)
Catch ex As Exception
End Try
but the GetDirectories line throws an exception:
但 GetDirectories 行引发异常:
The system detected a possible attempt to compromise security. Please ensure that you can contact the server that authenticated you.
系统检测到可能存在危及安全的企图。请确保您可以联系对您进行身份验证的服务器。
I'm starting to think there is a permissions problem here.... Do I have to programmatically authenticate again prior to doing this? If so how?
我开始认为这里存在权限问题......在执行此操作之前,我是否必须再次以编程方式进行身份验证?如果是这样怎么办?
Or is it not possible to do a GetDirectories over the network? Is there another way?
或者无法通过网络执行 GetDirectories ?还有其他方法吗?
Thanks for any advice!
感谢您的任何建议!
回答by TripleAntigen
In the end it turns out that I needed to use Impersonation, which lets me programmatically emulate another user while executing a block of code. No opening of ports was required.
最后证明我需要使用Impersonation,它让我在执行代码块时以编程方式模拟另一个用户。不需要开放端口。
回答by CBTTJM
Multiple network connections - Wireless, Wired Ethernet
多个网络连接 - 无线、有线以太网
The error “The system detected a possible attempt to compromise security.” started happening for me when I started alternately using a Wireless network connection at night and a wired Ethernet connection during the day.
错误“系统检测到可能破坏安全的企图。” 当我开始在晚上交替使用无线网络连接和白天使用有线以太网连接时,我开始发生这种情况。
回答by JakeGould
Microsoft explains it all as follows:
微软解释如下:
CAUSEThis problem occurs because the network firewall filters Kerberos traffic.
原因出现此问题的原因是网络防火墙筛选 Kerberos 通信。
RESOLUTIONTo resolve this problem, configure the network firewall so that TCP port 88 and UDP port 88 are not blocked for either domain.
解决方案要解决此问题,请配置网络防火墙,以便不会为任一域阻止 TCP 端口 88 和 UDP 端口 88。

