Sharepoint 2010 通过 wsp 将控件注册为安全
我使用 VS2010 创建了一个“Hello World”Sharepoint 2010 解决方案。它仅包含一个功能和一个包含标签的 Web 部件。我在 VS2010 的 Web 部件的“属性”窗口中将 Web 部件注册为安全控件。
当我将解决方案部署到本地服务器时,一切都运行良好!我可以将 Web 部件添加到页面,并在 web.config 文件中将我的控件添加到 SafeControls 列表中。当我在不同的服务器上安装相同的解决方案时,我可以在可用 Web 部件列表中看到该 Web 部件,但是当我尝试将其添加到页面时,它告诉我它未注册为安全。当我检查 web.config 文件时,没有我的控件的条目。如果我手动添加一个(来自我的开发服务器的),事情就会开始工作。
现在,我想知道为什么当我安装wsp文件时控件没有注册。 wsp 内的清单包含以下行:
<Assemblies>
<Assembly Location="abc.TestWebPart.dll" DeploymentTarget="GlobalAssemblyCache">
<SafeControls>
<SafeControl Assembly="abc.TestWebPart, Version=1.0.0.0, Culture=neutral, PublicKeyToken=e262c75e6f6e8440" Namespace="abc.TestWebPart.VisualWebPart1" TypeName="*" />
</SafeControls>
</Assembly>
非常欢迎任何想法!
I created a "Hello World" Sharepoint 2010 solution using VS2010. It contains just a feature, and a webpart containing a label. I registered the webpart as a safe control in the "Properties" window of the webpart, in VS2010.
When I deploy my solution to my local server, everything works great! I can add the webpart to a page, and in the web.config file my control is added to the SafeControls list. When I install the same solution on a different server, I can see the webpart in the list of available webparts, but when I try to add it to the page, it tells me that it's not registered as safe. When I check the web.config file, there is no entry for my control. If I add one manually (the one from my dev server), things start to work.
Now, I wonder why the control is not registered when I install the wsp file. The manifest inside the wsp contains this line:
<Assemblies>
<Assembly Location="abc.TestWebPart.dll" DeploymentTarget="GlobalAssemblyCache">
<SafeControls>
<SafeControl Assembly="abc.TestWebPart, Version=1.0.0.0, Culture=neutral, PublicKeyToken=e262c75e6f6e8440" Namespace="abc.TestWebPart.VisualWebPart1" TypeName="*" />
</SafeControls>
</Assembly>
Any ideas are very welcomed!
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(3)
检查拼写错误和版本差异。
Check for typos and version differences.
您是否激活了网络应用程序的功能?
Did you activate the feature for the web app?
我知道迟到的答案。
我认为您的 SafeControl 标签中缺少“ Safe=”TRUE” 。
正确代码:
Late answer I know.
I think you are missing ' Safe="TRUE" ' in your SafeControl Tag.
Correct code: