Sharepoint:是否可以自动部署自定义 CAS 策略?
我正在寻找一种在 SharePoint 中自动部署自定义 CAS 策略的方法。
我想要实现的目标如下:
由我们的构建服务器(使用密钥)构建和签名的所有程序集应在“高于正常”信任级别的 SharePoint 中运行。
现在我可以手动编辑 cas 策略文件以包含如下内容:
<CodeGroup class="UnionCodeGroup" version="1" PermissionSetName="MyPermissionSet" Name="[My Company public key]" Description="Grants all ">
<IMembershipCondition class="StrongNameMembershipCondition" version="1" PublicKeyBlob="[public key goes here]" />
</CodeGroup>
这非常有效。然而,我们有几个巨大的共享点场,上面运行着许多应用程序。我希望避免手动编辑所有策略文件以包含此 xml 片段。
有没有办法自动执行此操作?例如,来自某个功能?
谨致问候, 埃尔文·范德瓦尔克
I'm looking for a way to automate the deployment of a custom CAS policy in SharePoint.
What i would like to achieve is the following:
All assemblies that have been built and signed by our build server (with a secret key) should run in SharePoint under the 'higher than normal' trust level.
Now I can manually edit the cas policy files to include something like this:
<CodeGroup class="UnionCodeGroup" version="1" PermissionSetName="MyPermissionSet" Name="[My Company public key]" Description="Grants all ">
<IMembershipCondition class="StrongNameMembershipCondition" version="1" PublicKeyBlob="[public key goes here]" />
</CodeGroup>
And that works great. However, we have several huge sharepoint farms, with many applications running on it. I'd like to avoid having to manually edit all policy files to include this xml snippet.
Is there a way to automate this? For example, from a feature?
With kind regards,
Erwin van der Valk
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
希望您熟悉 .wsp 文件。这是将任何内容部署到场的标准方法。您还可以通过 wsp 文件部署 CAS 策略条目。 (也许您需要仅为您的 cas 策略创建一个 wsp 文件)。 wsp 文件与 cab 文件相同,只是重命名。 wsp 文件内有一个 manifest.xml,您可以在其中定义要对 CAS 文件应用哪些更改。这样做的好处是可以通过卸载 WSP 来恢复。我见过几种不同的部署 CAS 策略的方法,包括将自定义策略文件作为 wsp 的一部分,并像任何其他文件一样进行部署。
您应该谷歌 wsp cas 政策 manifest.xml 以获得进一步的教程。
希望这有帮助..
Hope you're familiar with .wsp files. This is a standard way to deploying anything to the farm. You can also deploy CAS policy entries though a wsp file. (Maybe you'll want to create a wsp file just for your cas policy). wsp files are the same as cab files, just renamed. Inside a wsp file lives manifest.xml in which you can define what changes to the CAS file you want to apply. The great thing about doing it this way that its reversible by uninstallaing the WSP. I've seen several different approaches to deploying CAS policies including having your custom policy file as part of your wsp and it gets deployed just like any other file.
You should google wsp cas policy manifest.xml for further tutorials.
Hope this helps..
这就是我为自动部署 WebPart 的 CAS 策略所做的操作:
以下内容的 Manifest.xml 文件:
在我的 .wsp 文件中,我有一个包含 必须深入研究 MS 文档以获取所需的权限,因为我花了一段时间才弄清楚我需要哪些权限。
.wsp 文件是使用以下命令创建的:(
我从 Microsoft 网站下载了 cabarc,但我不记得确切位置)
将 Web 部件解决方案部署到 SharePoint我使用以下命令:
allowCasPolicies 参数是必需的,因为解决方案包含 CAS 策略。如果没有它,它们将不会添加到 SharePoint 的 web.config 文件中。
This is what I have done to automate the deployment of CAS policies of my WebPart:
Inside my .wsp file, I have a Manifest.xml file with this content:
You will have to dig into the MS documentation for the Permissions you need because it took me a while to figure out which ones I need.
The .wsp file was created with the command:
(I downloaded cabarc from the Microsoft website, but I don't remember exactly where)
To deploy the Web Part solution into SharePoint I use these commands:
The allowCasPolicies parameter is necessary because the solution contains CAS policies. Without it, they will not be added to the web.config file of SharePoint.