WSPBuilder、配置存储和部分信任的调用者

发布于 2024-07-23 22:24:15 字数 1053 浏览 4 评论 0原文

有没有人使用 WSP Builder 来打包使用配置存储的解决方案 (http://www.codeplex.com/SPConfigStore ) 并部署到 Web 应用程序的 bin 目录?

当我尝试引用代码隐藏文件中的配置存储时,出现此异常...

System.Security.SecurityException:该程序集不允许部分受信任的调用者

我添加了部分受信任的调用者属性到我的项目

[assembly: AllowPartiallyTrustedCallers()]

和我的方法上的共享点权限属性

[SharePointPermissionAttribute(System.Security.Permissions.SecurityAction.Demand, Impersonate = true)] 
[SharePointPermissionAttribute(System.Security.Permissions.SecurityAction.Demand, ObjectModel = true)]

但这似乎没有做任何事情,我还指定了具有正确 IPermission 的自定义 CAS 策略

<IPermission class="Microsoft.SharePoint.Security.SharePointPermission, Microsoft.SharePoint.Security, version=12.0.0.0, Culture=neutral, PublicKeyToken=71e9bce111e9429c" version="1" ObjectModel="True" UnsafeSaveOnGet="True" Unrestricted="True" />

但仍然没有成功,肯定其他人已经这样做了,我一定是缺少一些东西

我正在使用 WSP Builder 版本 1.0.5。

Has anyone used WSP Builder to package a solution that uses the Config Store (http://www.codeplex.com/SPConfigStore) and deploys to the bin directory of the web application?

When I try to referecne the config store in my code behind file I get this exception...

System.Security.SecurityException: That assembly does not allow partially trusted callers

I've added the partially trusted callers attribute to my project

[assembly: AllowPartiallyTrustedCallers()]

and the sharepoint permissions attributes on my methods

[SharePointPermissionAttribute(System.Security.Permissions.SecurityAction.Demand, Impersonate = true)] 
[SharePointPermissionAttribute(System.Security.Permissions.SecurityAction.Demand, ObjectModel = true)]

But this hasn't seem to have done anything, I've also specified a custom CAS policy with the correct IPermission

<IPermission class="Microsoft.SharePoint.Security.SharePointPermission, Microsoft.SharePoint.Security, version=12.0.0.0, Culture=neutral, PublicKeyToken=71e9bce111e9429c" version="1" ObjectModel="True" UnsafeSaveOnGet="True" Unrestricted="True" />

And still no success, surely other people have done this, I must be missing something

I'm using WSP Builder version 1.0.5.

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

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

发布评论

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

评论(2

樱花落人离去 2024-07-30 22:24:15

您已将 [程序集:AllowPartiallyTrustedCallers()] 添加到您的程序集中,因此您的程序集将允许部分受信任的调用者调用它。
但ConfigStore本身没有这个属性。

是否可以将您的 DLL 添加到 GAC 中? (简单的办法)。
或者将 [程序集:AllowPartiallyTrustedCallers()] 添加到 ConfigStore 项目中。

You have added the [assembly: AllowPartiallyTrustedCallers()] to YOUR assembly, so your assembly WILL allow for partially trusted callers to call IT.
But the ConfigStore itself does not have that attribute.

Is it possible to add your DLL to the GAC? (easy way out).
Or add the [assembly: AllowPartiallyTrustedCallers()] to the ConfigStore project as well..

×纯※雪 2024-07-30 22:24:15

您是否将该程序集添加到了 web.config SafeControls 部分?

<SafeControl Assembly="Microsoft.Office.Server.Search, Version=12.0.0.0, Culture=neutral, PublicKeyToken=71e9bce111e9429c" Namespace="Microsoft.Office.Server.Search.WebControls" TypeName="*" Safe="True" />

此外,您可能需要降低 web.config 中的信任级别:

<trust level="WSS_Minimal" originUrl="" />

请参阅 MSDN 文档以获取 ASP.Net 和 SharePoint 信任级别

Did you add the assembly to the web.config SafeControls section?

<SafeControl Assembly="Microsoft.Office.Server.Search, Version=12.0.0.0, Culture=neutral, PublicKeyToken=71e9bce111e9429c" Namespace="Microsoft.Office.Server.Search.WebControls" TypeName="*" Safe="True" />

Also you may need to lower the trust level in the web.config:

<trust level="WSS_Minimal" originUrl="" />

See the MSDN docs for ASP.Net and SharePoint trust levels.

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