简体   繁体   English

Caspol:从网络共享中的程序集调用方法

[英]Caspol: Calling a method from an assembly on a network share

I have compiled an assembly using the Microsoft Strong Name key convention and marked it to be "AllowPartiallyTrusted". 我已经使用Microsoft Strong Name密钥约定编译了一个程序集,并将其标记为“ AllowPartiallyTrusted”。

I am testing the application against this assembly from two different machines. 我正在针对来自两台不同计算机的程序集测试该应用程序。 One is running windows 2003 server and the other machine is on windows XP Professional. 一台运行Windows 2003 Server,另一台运行Windows XP Professional。

I am able to invoke the methods on the assembly from the Win 2003 server, but when it comes to the XP machine, it fails. 我可以从Win 2003服务器上调用程序集上的方法,但是当涉及XP机器时,它将失败。

I have tried to set the INTRANET ZONES TO FULL TRUST, but that hasn't worked for the XP. 我曾尝试将“ Intranet区域”设置为“完全信任”,但这不适用于XP。 One difference between the XP and the 2003 server is that the XP is 32 bit and has frameworks 1 -4.0 installed on it. XP和2003服务器之间的区别是XP是32位的,并安装了框架1 -4.0。 The 2003 has just the 3.5 SP1 installed on it. 2003上仅安装了3.5 SP1。

I am an administrator on the XP machine, but not on the 2003 machine where it works. 我是XP计算机的管理员,但不是该计算机所在的2003计算机的管理员。 This is driving me nuts. 这让我发疯。

The Windows permissions shouldn't matter - it's a Code Access Security issue. Windows权限无关紧要-这是代码访问安全性问题。 It's difficult to diagnose the problem without knowing more about the errors you're encountering. 如果不了解您遇到的错误,就很难诊断问题。 The AllowPartiallyTrustedCallersAttribute (APTCA) is meant to allow partially trusted code to call fully trusted code, but the .NET 4.0 security model has changed the way APTCA works. AllowPartiallyTrustedCallersAttribute(APTCA)旨在允许部分受信任的代码调用完全受信任的代码,但是.NET 4.0安全模型已更改了APTCA的工作方式。 See this blog post for details , but in .NET 4.0 APTCA assemblies are marked SecurityTransparent , and cannot call SecurityCritical assemblies, which is the default protection level for .NET assemblies. 有关详细信息 ,请参见此博客文章,但在.NET 4.0中,APTCA程序集被标记为SecurityTransparent ,并且无法调用SecurityCritical程序集,这是.NET程序集的默认保护级别。

So, if your APTCA assembly in .NET 4.0 is doing anything privileged, like calling SecurityCritical code or asserting permissions, then it will fail. 因此,如果您在.NET 4.0中的APTCA程序集执行特权操作,例如调用SecurityCritical代码或声明权限,则它将失败。 You should consider making it SecuritySafeCritical so that it can be called by SecurityTransparent code and call SecurityCritical code. 您应该考虑使其成为SecuritySafeCritical以便可以由SecurityTransparent代码调用它并调用SecurityCritical代码。 Of course, you'll want to make sure that it can't be exploited by untrusted libraries, just like APTCA code. 当然,您将要确保它不能被不受信任的库利用,就像APTCA代码一样。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM