当我尝试boo.exe
从网络共享(映射到驱动器)运行 .NET 程序集 ( ) 时,它失败了,因为它只是部分受信任:
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
根据博客文章中的说明,我向 .NET 配置添加了一个策略,该策略完全信任所有程序集file:///H:/*
作为其 URL。我通过在 .NET 配置中将 URL 输入file:///H:/boo-svn/bin/boo.exe
到Evaluate Assembly工具中验证了这一点,并注意到 boo.exe 具有Unrestricted权限(在策略之前它没有)。
即使有许可,boo.exe
也不会运行。我仍然收到相同的错误消息。
我能做些什么来调试这个问题?是否有另一种方法可以从网络共享运行“部分受信任”的程序集,而不必为我要运行的每个程序集更改某些内容?