使用 Linq-to-SQL 的中等信任 ASP.NET MVC 应用程序上的 Cassini 异常

发布于 2024-07-30 03:17:30 字数 1290 浏览 3 评论 0原文

我在尝试在 Cassini 3.5.0.2 上浏览中等信任 ASP.NET MVC 应用程序(使用 Linq-to-SQL)时收到以下异常:

Could not load file or assembly 'Cassini, Version=3.5.0.2, Culture=neutral, PublicKeyToken=da0fefd60d522a7d'
or one of its dependencies. Failed to grant permission to execute. (Exception from HRESULT: 0x80131418)

有一个内部异常:

Execution permission cannot be acquired.

Stack trace:
at System.Security.SecurityManager.ResolvePolicy(Evidence evidence, PermissionSet reqdPset, PermissionSet optPset,
    PermissionSet denyPset, PermissionSet& denied, Boolean checkExecutionPermission)
at System.Security.SecurityManager.ResolvePolicy(Evidence evidence, PermissionSet reqdPset, PermissionSet optPset,
    PermissionSet denyPset, PermissionSet& denied, Int32& securitySpecialFlags, Boolean checkExecutionPermission)

同一应用程序在 IIS7 和内部 VS2008 Web 服务器上运行。 Cassini 与不使用 Linq-to-SQL 的 ASP.NET MVC 应用程序一起工作没有任何问题。

ASP.NET MVC 应用程序和 Linq-to-SQL 存储库项目都应用了 [程序集:System.Security.AllowPartiallyTrustedCallers],以便在中等信任度下工作。

有人对这个问题有任何线索吗?

编辑

Server.cs 中的这一行引发异常:

return appManager.CreateObject(appId, hostType, virtualPath, physicalPath, false);

I am receiving the following exception trying to browse a medium trust ASP.NET MVC application (using Linq-to-SQL) on Cassini 3.5.0.2:

Could not load file or assembly 'Cassini, Version=3.5.0.2, Culture=neutral, PublicKeyToken=da0fefd60d522a7d'
or one of its dependencies. Failed to grant permission to execute. (Exception from HRESULT: 0x80131418)

with an inner exception:

Execution permission cannot be acquired.

Stack trace:
at System.Security.SecurityManager.ResolvePolicy(Evidence evidence, PermissionSet reqdPset, PermissionSet optPset,
    PermissionSet denyPset, PermissionSet& denied, Boolean checkExecutionPermission)
at System.Security.SecurityManager.ResolvePolicy(Evidence evidence, PermissionSet reqdPset, PermissionSet optPset,
    PermissionSet denyPset, PermissionSet& denied, Int32& securitySpecialFlags, Boolean checkExecutionPermission)

The same application works on IIS7 and on internal VS2008 web server. Cassini works without any problems with ASP.NET MVC application which are not using Linq-to-SQL.

Both the ASP.NET MVC application and the Linq-to-SQL repository project have [assembly: System.Security.AllowPartiallyTrustedCallers] applied in order to work in medium trust.

Has anyone any clue about this problem?

EDIT

The exception is thrown on this line from Server.cs:

return appManager.CreateObject(appId, hostType, virtualPath, physicalPath, false);

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

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

发布评论

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

评论(1

陌路黄昏 2024-08-06 03:17:30

[ http://blogs.msdn.com/dmitryr/archive/2009/04/23/cassini-support-for-friend-urls-routing.aspx#9855758]

不幸的是,这是单一的副作用-EXE卡西尼号。 在工作应用程序域中,Cassini EXE 被视为不受信任的代码。

为了使其在中等信任中工作,您需要修改中等信任定义(以允许由您的密钥签名的程序集获得完全信任)或返回将 Cassini 放入 GAC,就像以前的版本一样。

谢谢,

德米特里

[http://blogs.msdn.com/dmitryr/archive/2009/04/23/cassini-support-for-friendly-urls-routing.aspx#9855758]

Unfortunately this is a side-effect of the single-EXE Cassini. In the worker app domain Cassini EXE is treated as untrusted code.

To make it work in Medium trust, you need either tinker with Medium Trust definition (to allow Assemblies signed by your key to get Full Trust) or go back to putting Cassini into GAC, as in previous versions.

Thanks,

Dmitry

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