跑步与QUOT;部分信任"从网络共享.NET程序集 [英] Running "partially trusted" .NET assemblies from a network share
问题描述
当我尝试从网络共享(映射到一个驱动器).NET程序集( boo.exe
),它失败,因为它只是部分受信任的:
When I try to run a .NET assembly (boo.exe
) from a network share (mapped to a drive), it fails since it's only partially trusted:
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
With instructions from a blog post, I added a policy to the .NET Configuration fully trusting all assemblies with file:///H:/*
as their URL. I verified this by entering the URL file:///H:/boo-svn/bin/boo.exe
into the Evaluate Assembly tool in the .NET Configuration and noting that boo.exe had the Unrestricted permission (which it didn't have before the policy).
即使使用许可, boo.exe
不运行。我仍然得到同样的错误信息。
Even with the permission, boo.exe
does not run. I still get the same error message.
我能做些什么来调试这个问题?有另一种方式来运行网络共享部分受信任的集而不需要改变某些事情了每一个组件,我想运行?
What can I do to debug this problem? Is there another way to run "partially trusted" assemblies from network shares without having to change something for every assembly I want to run?
推荐答案
使用.NET 3.5 SP1,UNC共享运行.NET程序集具有完全控制权限。
With .NET 3.5 SP1, .NET assemblies running from UNC shares have full permissions.
请参阅布拉德·艾布拉姆斯的<一个href="http://blogs.msdn.com/brada/archive/2007/10/26/adhoc-poll-allowing-net-exes-to-run-off-a-network-share.aspx">Allow .EXE文件被流掉的网络股获取解决方法和讨论,最后跟进<一个href="http://blogs.msdn.com/brada/archive/2008/08/13/net-framework-3-5-sp1-allows-managed-$c$c-to-be-launched-from-a-network-share.aspx">.NET 3.5 SP1允许管理code从网络共享推出。
See Brad Abrams's Allow .exes to be run off a network shares for workaround and discussions, and finally the follow up .NET 3.5 SP1 allows managed code to be launched from a network share.
这篇关于跑步与QUOT;部分信任&QUOT;从网络共享.NET程序集的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!