使用解决方案框架在 Sharepoint 中部署 CAS 策略

发布于 2024-07-15 22:45:04 字数 2207 浏览 4 评论 0原文

我正在使用 sharepoint 解决方案机制部署我的 Web 部件。 现在,一切工作正常,但当我将 CAS 策略添加到 manifest.xml 文件时,部署无法正常工作。 使用 CAS 策略部署解决方案时,不会出现错误,但不会创建策略文件、不会复制 dll,并且不会将 SafeControls 条目添加到 web.config 中。 我的manifest.xml 文件如下所示:

<Solution SolutionId="{8099F953-02F2-49e1-B620-06B9050515A3}"
          xmlns="http://schemas.microsoft.com/sharepoint/">

  <FeatureManifests>
    <FeatureManifest Location="Przydzialy\feature.xml" />
  </FeatureManifests>

  <TemplateFiles>
    <TemplateFile Location="FEATURES\Przydzialy\AjaxWebPart.dwp" />
    <TemplateFile Location="FEATURES\Przydzialy\UserControlContainer.dwp" />
  </TemplateFiles>

  <Assemblies>
    <Assembly DeploymentTarget="WebApplication" Location="Package.WebParts.dll">
      <SafeControls>
        <SafeControl Assembly="Package.WebParts, Version=1.0.0.0, Culture=neutral, PublicKeyToken=9a8b1f3d028b8494" Namespace="Package.WebParts" TypeName="UserControlContainer" Safe="True" />
        <SafeControl Assembly="Package.WebParts, Version=1.0.0.0, Culture=neutral, PublicKeyToken=9a8b1f3d028b8494" Namespace="Package.WebParts" TypeName="AjaxWebPart" Safe="True" />
        <SafeControl Assembly="Package.WebParts, Version=1.0.0.0, Culture=neutral, PublicKeyToken=9a8b1f3d028b8494" Namespace="Package.WebParts" TypeName="ProgressTemplate" Safe="True" />
        <SafeControl Assembly="Package.WebParts, Version=1.0.0.0, Culture=neutral, PublicKeyToken=9a8b1f3d028b8494" Namespace="Package.WebParts.SmartWebPart" TypeName="UserControlContainerToolPart" Safe="True" />
      </SafeControls>
    </Assembly>
  </Assemblies>

  <CodeAccessSecurity>
    <PolicyItem>
      <PermissionSet class="NamedPermissionSet" version="1" Description="Permission set for Package.WebParts">
        <IPermission class="AspNetHostingPermission" version="1" Level="Medium" />
      </PermissionSet>
      <Assemblies>
        <Assembly Name="Package.WebParts" />
      </Assemblies>
    </PolicyItem>
  </CodeAccessSecurity>

</Solution>

以前有人遇到过这样的问题吗? 目前我已经没有想法了,所以我愿意接受建议。

I'm deploying my web parts using the sharepoint solution mechanism. Untul now, everything worked fine, but when i added CAS policies to the manifest.xml file, the deployment doesn't work as it should.
When deploying the solution with the CAS policies, there are no errors, but the policy file isn't created, the dll isn't copied, and the SafeControls entries aren't added to the web.config. My manifest.xml file looks like this :

<Solution SolutionId="{8099F953-02F2-49e1-B620-06B9050515A3}"
          xmlns="http://schemas.microsoft.com/sharepoint/">

  <FeatureManifests>
    <FeatureManifest Location="Przydzialy\feature.xml" />
  </FeatureManifests>

  <TemplateFiles>
    <TemplateFile Location="FEATURES\Przydzialy\AjaxWebPart.dwp" />
    <TemplateFile Location="FEATURES\Przydzialy\UserControlContainer.dwp" />
  </TemplateFiles>

  <Assemblies>
    <Assembly DeploymentTarget="WebApplication" Location="Package.WebParts.dll">
      <SafeControls>
        <SafeControl Assembly="Package.WebParts, Version=1.0.0.0, Culture=neutral, PublicKeyToken=9a8b1f3d028b8494" Namespace="Package.WebParts" TypeName="UserControlContainer" Safe="True" />
        <SafeControl Assembly="Package.WebParts, Version=1.0.0.0, Culture=neutral, PublicKeyToken=9a8b1f3d028b8494" Namespace="Package.WebParts" TypeName="AjaxWebPart" Safe="True" />
        <SafeControl Assembly="Package.WebParts, Version=1.0.0.0, Culture=neutral, PublicKeyToken=9a8b1f3d028b8494" Namespace="Package.WebParts" TypeName="ProgressTemplate" Safe="True" />
        <SafeControl Assembly="Package.WebParts, Version=1.0.0.0, Culture=neutral, PublicKeyToken=9a8b1f3d028b8494" Namespace="Package.WebParts.SmartWebPart" TypeName="UserControlContainerToolPart" Safe="True" />
      </SafeControls>
    </Assembly>
  </Assemblies>

  <CodeAccessSecurity>
    <PolicyItem>
      <PermissionSet class="NamedPermissionSet" version="1" Description="Permission set for Package.WebParts">
        <IPermission class="AspNetHostingPermission" version="1" Level="Medium" />
      </PermissionSet>
      <Assemblies>
        <Assembly Name="Package.WebParts" />
      </Assemblies>
    </PolicyItem>
  </CodeAccessSecurity>

</Solution>

Did anybody had a problem like that befor ? I've run out of ideas at this point, so I'm open for suggestions.

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

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

发布评论

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

评论(1

箹锭⒈辈孓 2024-07-22 22:45:04

检查您的 web.config 并确保信任级别未设置为完全。 如果您尚未部署任何 CAS 策略,则应将其设置为 WSS_Minimal;如果您已经部署了某些策略,则应将其设置为 WSS_Custom。 确保解决方案包中没有任何只读文件,因为这会导致问题。

最后,您是通过 Central Admin 还是 stsadm 部署您的解决方案? 如果您通过 stsadm 进行部署,请转到中央管理并查看部署解决方案时是否显示任何错误。

您很可能还需要更多权限集,请在此处查看我的帖子,了解有关 代码访问安全

Check your web.config and make sure that the trust level is not set to full. It should be set to WSS_Minimal if you haven't deployed any CAS policies yet or WSS_Custom if you have already deployed something. Make sure that you don't have any readonly files in your solution package as that causes problems.

Lastly, are you deploying your solution via Central Admin or stsadm? If you are deploying via stsadm, then go to central admin and see if there are any errors shown when you deploy your solution.

More than likely you are going to need more permissionSets as well, check my post here for more on Code Access Security.

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