我似乎无法运行一个简单的控制台应用程序,它只打印出
"Hello World"
,然后打印 Readline()
来结束程序。
NB,这种情况只发生在我的工作电脑上。我的个人电脑上没有这个问题。
我解释一下我做了什么。
Visual Studio: Community 2022 (64-bit) - Version 17.8.5
OS: Windows 11 Business Version 10.0.22631
在 Visual Studio 中,当我运行项目时,出现以下错误:
尝试运行项目时出错:无法启动程序 [PATH TO EXE文件]
访问被拒绝
然后,我在 Windows Explorer 中打开项目文件夹,并手动运行 Debug 文件夹中的 exe 文件。我收到一条类似的错误消息,但措辞略有不同:
Windows 无法访问指定的设备、路径或文件。你不可以 拥有访问该项目的适当权限。
好像存在用户权限问题。我打开包含文件夹的安全属性,并注意到提到了我的用户,并且它对该文件夹具有完全控制权限。
请注意,在我的 Windows 安全 设置中,我还尝试停用 基于信誉的保护 以允许运行无法识别的应用程序和文件。尽管如此,不建议这样做,但我这样做只是为了看看它是否有什么不同。
正如我所说,在我运行完全相同的程序的个人电脑上不需要这些。我已经不知道该去哪里寻找了。
可能的原因是:
查看事件查看器 -> 应用程序和服务日志 ->
/Microsoft/Windows/Windows Defender/Operational
就我而言,我看到的事件表明威胁防护是原因所在。
这是我来自 eventvwr 的法语错误消息的副驾驶翻译:
Microsoft Defender Exploit Guard has blocked an operation that is not authorized by your IT administrator.
For more information, contact your IT administrator.
ID: 01443614-CD74-433A-B99E-2ECDC07BFC25
Detection Duration: 2024-01-22T20:10:46.962Z
User: _
Path: C:\Users_\source\repos____.exe
Process Name: C:\Windows\explorer.exe
Target Command Line:
Parent Command Line: C:\WINDOWS\Explorer.EXE
Affected Folder:
Inheritance Indicator: 0x00000000
Security Intelligence Version: 1.403.2529.0
Engine Version: 1.1.23110.2
Product Version: 4.18.23110.3
法国原创活动:
Microsoft Defender exploit Guard a bloqué une opération qui n’est pas autorisée par votre administrateur informatique.
pour plus d’informations, contactez votre administrateur informatique.
ID : 01443614-CD74-433A-B99E-2ECDC07BFC25
Durée de détection : 2024-01-22T20:10:46.962Z
Utilisateur : ____\____
Chemin d’accès : C:\Users\____\source\repos\______.exe
Nom du processus : C:\Windows\explorer.exe
Ligne de commande cible :
Ligne de commande parents : C:\WINDOWS\Explorer.EXE
Dossier concerné :
Indicateur d'héritage : 0x00000000
Version de la veille de sécurité : 1.403.2529.0
Version du moteur : 1.1.23110.2
Version du produit : 4.18.23110.3