尽管该区域是完全受信任的,但该程序集不允许部分受信任的调用者

发布于 2024-09-03 00:18:01 字数 866 浏览 6 评论 0原文

从昨天开始,当我想在 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 版本有关?

Since yesterday, I receive a security exception when I want to run a unit-test from within VS.NET 2008.
The error goes like this:

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

The S: drive is a mapped drive which points to a physical location on my disk.

What I find very strange, is that this used to work for months previously. I mean, I did this all the time.
In order to get this to work, I 've created a new security zone with the caspol utility in order to give this S: network share drive FullTrust.
In other words, when I run

caspol -m -lg

I see this (I removed the other zones for the sake of brevity):

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

I've added the 1.2.5 zone just recently because the error that was given, mentionned file:///s:/....

Any ideas ?

Could it be that this has something to do with the installation of VS.NET 2010 or the .NET Framework version 4.0 ?

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

有深☉意 2024-09-10 00:18:01

尝试添加

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

到您的 web.config。

Try adding

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

to your web.config.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文