【问题标题】:That assembly does not allow partially trusted callers although the zone is fully trusted尽管该区域是完全受信任的,但该程序集不允许部分受信任的调用者
【发布时间】:2010-05-27 09:50:01
【问题描述】:

从昨天开始,当我想在 VS.NET 2008 中运行单元测试时,我收到了一个安全异常。 错误是这样的:

SecurityException: that assembly does not allow partially trusted callers
... 
The assembly that failed was : file:///S:/MyProject/MyAssembly.dll

S: 驱动器是一个映射驱动器,它指向我磁盘上的物理位置。

我觉得很奇怪的是,这在以前可以工作几个月。我的意思是,我一直这样做。 为了让它工作,我用 caspol 实用程序创建了一个新的安全区域,以便为这个 S:网络共享驱动器提供 FullTrust。 换句话说,当我运行

caspol -m -lg

我看到了(为简洁起见,我删除了其他区域):

1.2.  Zone - Intranet: LocalIntranet
   1.2.1.  All code: Same site Web
   1.2.2.  All code: Same directory FileIO - 'Read, PathDiscovery'
   1.2.3.  Url - file://R:/*: FullTrust
   1.2.4.  Url - file://S:/*: FullTrust
   1.2.5.  Url - file:///S:/*: FullTrust

我最近刚刚添加了 1.2.5 区域,因为给出的错误提到了 file:///s:/....

有什么想法吗?

会不会是和安装VS.NET 2010或者.NET Framework 4.0版本有关?

【问题讨论】:

    标签: c# .net caspol


    【解决方案1】:

    尝试添加

    <configuration>
      <system.web>
        <trust level="Full" />
      </system.web>
    </configuration>
    

    到您的 web.config。

    【讨论】:

    • 这不是一个 web 项目,所以我没有 web.config。 :)
    猜你喜欢
    • 2012-08-05
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2011-02-18
    相关资源
    最近更新 更多