SharePoint WebPart 包和 dll

发布于 2024-07-11 21:23:58 字数 1508 浏览 8 评论 0原文

我在 Visual Studio 中有一个 SharePoint WebPart 项目。 作为项目的一部分,我引用了 interop.ActiveDS.dll。

我可以成功编译项目并将解决方案添加/部署到 SharePoint。 当我尝试在 SharePoint 中运行 WebPart 时,出现错误:

That assembly does not allow partially trusted callers.

[SecurityException: That assembly does not allow partially trusted callers.]
   PeopleAdWebPart.PeopleAdWebPart.OnLoad(EventArgs e) +0
   System.Web.UI.Control.LoadRecursive() +47
   System.Web.UI.Control.LoadRecursive() +131
   System.Web.UI.Control.LoadRecursive() +131
   System.Web.UI.Control.LoadRecursive() +131
   System.Web.UI.Control.LoadRecursive() +131
   System.Web.UI.Control.LoadRecursive() +131
   System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint) +7350
   System.Web.UI.Page.ProcessRequest(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint) +213
   System.Web.UI.Page.ProcessRequest() +86
   System.Web.UI.Page.ProcessRequestWithNoAssert(HttpContext context) +18
   System.Web.UI.Page.ProcessRequest(HttpContext context) +49
   Microsoft.SharePoint.Publishing.TemplateRedirectionPage.ProcessRequest(HttpContext context) +153
   System.Web.CallHandlerExecutionStep.System.Web.HttpApplication.IExecutionStep.Execute() +358
   System.Web.HttpApplication.ExecuteStep(IExecutionStep step, Boolean& completedSynchronously) +64

我已将 [程序集:System.Security.AllowPartiallyTrustedCallers] 添加到 assemblyinfo.cs 文件中,但这没有帮助。

如果有任何答案,我将不胜感激!

I have a SharePoint WebPart project in visual studio. As part of the project I am referencing the interop.ActiveDS.dll.

I can compile the project successfully and add/deploy the solution to SharePoint. When I try to run the WebPart in SharePoint I get the error:

That assembly does not allow partially trusted callers.

[SecurityException: That assembly does not allow partially trusted callers.]
   PeopleAdWebPart.PeopleAdWebPart.OnLoad(EventArgs e) +0
   System.Web.UI.Control.LoadRecursive() +47
   System.Web.UI.Control.LoadRecursive() +131
   System.Web.UI.Control.LoadRecursive() +131
   System.Web.UI.Control.LoadRecursive() +131
   System.Web.UI.Control.LoadRecursive() +131
   System.Web.UI.Control.LoadRecursive() +131
   System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint) +7350
   System.Web.UI.Page.ProcessRequest(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint) +213
   System.Web.UI.Page.ProcessRequest() +86
   System.Web.UI.Page.ProcessRequestWithNoAssert(HttpContext context) +18
   System.Web.UI.Page.ProcessRequest(HttpContext context) +49
   Microsoft.SharePoint.Publishing.TemplateRedirectionPage.ProcessRequest(HttpContext context) +153
   System.Web.CallHandlerExecutionStep.System.Web.HttpApplication.IExecutionStep.Execute() +358
   System.Web.HttpApplication.ExecuteStep(IExecutionStep step, Boolean& completedSynchronously) +64

I have added [assembly: System.Security.AllowPartiallyTrustedCallers] to the assemblyinfo.cs file but this has not helped.

Would appreciate any answers for this!

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

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

发布评论

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

评论(2

要走干脆点 2024-07-18 21:23:58

问题是 Interop.ActiveDs.dll 不允许部分受信任的调用者。 最好的选择是将签名的互操作程序集部署到 GAC:

TlbImp %windir%\system32\ActiveDs.tlb /out:Interop.ActiveDs.dll /keyfile:KeyFile.snk

The problem is that Interop.ActiveDs.dll does not allow partially trusted callers. Your best bet is to deploy a signed interop assembly to the GAC:

TlbImp %windir%\system32\ActiveDs.tlb /out:Interop.ActiveDs.dll /keyfile:KeyFile.snk
~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文