【发布时间】:2008-08-23 18:33:55
【问题描述】:
当我尝试从网络共享(映射到驱动器)运行 .NET 程序集 (boo.exe) 时,它失败了,因为它只是部分受信任:
Unhandled Exception: System.Security.SecurityException: That assembly does not allow partially trusted callers.
at System.Security.CodeAccessSecurityEngine.ThrowSecurityException(Assembly asm, PermissionSet granted, PermissionSet refused, RuntimeMethodHandle rmh, SecurityAction action, Object demand, IPermission permThatFailed)
at BooCommandLine..ctor()
at Program..ctor()
at ProgramModule.Main(String[] argv)
The action that failed was:
LinkDemand
The assembly or AppDomain that failed was:
boo, Version=0.0.0.0, Culture=neutral, PublicKeyToken=32c39770e9a21a67
The Zone of the assembly that failed was:
Intranet
The Url of the assembly that failed was:
file:///H:/boo-svn/bin/boo.exe
根据a blog post 的指示,我向 .NET 配置添加了一个策略,该策略完全信任所有以file:///H:/* 作为其 URL 的程序集。我通过在 .NET 配置中的 Evaluate Assembly 工具中输入 URL file:///H:/boo-svn/bin/boo.exe 来验证这一点,并注意到 boo.exe 具有 Unrestricted 权限(它没有有之前的政策)。
即使有权限,boo.exe 也不会运行。我仍然收到相同的错误消息。
我可以做些什么来调试这个问题?是否有另一种方法可以从网络共享运行“部分受信任”的程序集,而无需为我要运行的每个程序集进行更改?
【问题讨论】: