下载 Castle.Core 并添加 [AllowPatiallyTrustedCallers]

发布于 2024-08-16 10:29:08 字数 877 浏览 3 评论 0原文

我想在中等信任度下运行 Castle.Core,并且理论上我知道如何做到这一点。

  1. 将 [AllowPatiallyTrustedCallers] 添加到 Assembly.cs
  2. 禁用跟踪记录器 - (因为它使用反射)

第一个问题,没有 Assembly.cs,所以显然您可以使用 nant 通过命令行进行构建,例如:

nant -D : assembly.allow-partially-trusted-callers=true

但这会返回错误

NAnt 0.84 (Build 0.84.1455.0; net-1.0.win32; release; 26/12/2003)
Copyright (C) 2001-2003 Gerry Shaw
http://nant.sourceforge.net

Buildfile: file:///D:/Downloads/development - source/Castle Proxy/Core/src/Castl
e.Core/default.build
Target(s) specified: nant

BUILD FAILED

Property 'project::get-name()' has not been set.

Total time: 0.1 seconds.

如何设置或解决问题? Castle.Core 的 svn 是 https://svn.castleproject.org/svn /castle/Core/trunk 因此,如果您愿意,欢迎在回答之前检查一下

I want to run Castle.Core under medium trust, and I know how to do it in theory.

  1. Add [AllowPatiallyTrustedCallers] to the Assembly.cs
  2. Disable Trace Logger - (because it uses reflection)

First problem, there is is no Assembly.cs, so apparently you can use nant to build with a command line like:

nant -D:assembly.allow-partially-trusted-callers=true

But that returns an error

NAnt 0.84 (Build 0.84.1455.0; net-1.0.win32; release; 26/12/2003)
Copyright (C) 2001-2003 Gerry Shaw
http://nant.sourceforge.net

Buildfile: file:///D:/Downloads/development - source/Castle Proxy/Core/src/Castl
e.Core/default.build
Target(s) specified: nant

BUILD FAILED

Property 'project::get-name()' has not been set.

Total time: 0.1 seconds.

How do I set this or resolve the issue?
The svn for this the Castle.Core is https://svn.castleproject.org/svn/castle/Core/trunk so your welcome to check it out before answering if you want

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

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

发布评论

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

评论(2

浮光之海 2024-08-23 10:29:08

[更新]

好吧,我的错。我不是中等信任问题的专家,但我的理解方式< /a>,毕竟您在 Castle 程序集上需要 APTCA。

所以这就是我所做的:

我从以下位置提取了 Castle Core: https://svn.castleproject。 org/svn/castle/Core/trunk
下载了 NAnt 的最新夜间版本,并使用 nant build -D: assembly.allow-partially-trusted-callers=true 构建它,

然后我从以下位置下载了动态代理: https://svn.castleproject.org/svn/castle/DynamicProxy/trunk

复制了我在上一步中构建的核心程序集到 lib/net-35,然后使用相同的 Nant 命令构建 DP。

然后,我创建了一个 ASP.NET 网站,将信任级别设置为“中”,并在其中生成了几个代理,结果成功了。

如果由于某种原因这对您不起作用,或者您有任何其他问题/建议,请告诉我。

[UPDATE]

OK, my bad. I'm not an expert in medium trust issues, but the way I understand it, you need APTCA on Castle assemblies after all.

So here's what I did:

I pulled Castle Core from: https://svn.castleproject.org/svn/castle/Core/trunk
downloaded latest nightly build of NAnt and built it with nant build -D:assembly.allow-partially-trusted-callers=true

I then downloaded Dynamic Proxy from: https://svn.castleproject.org/svn/castle/DynamicProxy/trunk

copied the Core assembly I built in previous step to lib/net-35 and then built DP with the same Nant command.

I then created an ASP.NET website with trust level set to Medium and generated a couple of proxies in it, and it worked.

If for some reason that does not work for you, or you have any other issues/suggestions let me know.

无力看清 2024-08-23 10:29:08

我认为你的做法是错误的 - 你不需要添加 [AllowPatiallyTrustedCallers] 来以中等信任度运行。如果您要对程序集进行 GAC,则仅需要 APTCA,在这种情况下,您不需要远程跟踪记录器,因为 GAC 程序集在完全信任的情况下运行,并且反射可以工作。

I think you're going the wrong way about it - You don't need to add [AllowPatiallyTrustedCallers] to run in medium trust. You only need APTCA if you're going to GAC the assembly, in which case you wouldn't need to remote Trace Logger because GACed assemblies run in full trust and reflection would work.

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