SecurityCritical上被覆盖的功能InitializeLifetimeService没有影响 [英] SecurityCritical on overriden function InitializeLifetimeService has not affect

查看:359
本文介绍了SecurityCritical上被覆盖的功能InitializeLifetimeService没有影响的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在与一些库中的一些信任问题。我能够重现错误与样品和参考,在我的MVC probject。 ,我试图让通过这个问题,但不明白我错过了什么。

I'm running into some Medium trust issues with a few libraries. I'm able to reproduce the error with a sample and referencing that in my MVC probject. I'm trying to get pass this problem but don't understand what I'm missing.

我不断收到此错误:

继承安全规则违反
  而重写成员:
  Temp.Class1.InitializeLifetimeService()。
  的安全辅助功能
  压倒一切的方法必须符合
  该方法的安全辅助功能
  被覆盖。

Inheritance security rules violated while overriding member: 'Temp.Class1.InitializeLifetimeService()'. Security accessibility of the overriding method must match the security accessibility of the method being overriden.

我想明白上面的安全透明的错误,并确保我的方法是一样的覆盖方法。这里是我的类:

I think understand the security transparency error above, and I make sure my method is the same as the overriding method. Here is my class:

public class Class1 : MarshalByRefObject
{

    [SecurityCritical]
    public override object InitializeLifetimeService()
    {
        return null;
    }

}

和我仍然得到相同的错误之上。

And I am still getting the same error as above.

已经加入并没有影响删除此行:

Have been adding and removing this line with no effect:

[assembly: AllowPartiallyTrustedCallers()]

阅读其他文章都是我所要做的就是给SecurityCritical属性添加到方法,但它似乎没有任何影响。

Reading other articles all I have to do is to add the SecurityCritical attribute to the method, but it does not seem to have any affect.

任何想法,或者说我失踪?

Any ideas, or something that I'm missing?

推荐答案

在一个中等信任的Web应用程序,只GACed二进制文件授予完全信任权限。如果你的二进制文件仓部署,这是部分信任和透明。 MSDN有什么透明code能和不能做一个好的写了。重要的是,声明[SecurityCritical]成员是完全信任的唯一操作。如果你的bin部署库包含[SecurityCritical]注释成员,CLR将忽略注释。

In a Medium trust web application, only GACed binaries are granted full trust permissions. If your binary is bin-deployed, it is partial-trust and transparent. MSDN has a good write-up of what transparent code can and cannot do. Importantly, declaring a [SecurityCritical] member is a full-trust only operation. If your bin-deployed library contains a member annotated with [SecurityCritical], the CLR will ignore that annotation.

如果您的库被设计成彬部署和中等信任可运行的,不能覆盖或以其它方式访问[SecurityCritical]成员。考虑重新加工您的库,以便不调用这些方法。

If your library is designed to be bin-deployed and runnable in Medium trust, you cannot override or otherwise access a [SecurityCritical] member. Consider reworking your library so as not to call these methods.

这篇关于SecurityCritical上被覆盖的功能InitializeLifetimeService没有影响的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆