Sharepoint WebPart 未安装
对于调试未安装的 WebPart,您有哪些技巧? 每个回复一个提示。
What tips do you have for debugging a WebPart that is not installing? One tip per response.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(5)
新手最常见的问题之一可能是代码访问安全性。 Web 部件开发人员的常见安全陷阱是一篇关于解决此问题的好文章扬·蒂伦斯 (Jan Tielens) 着。 它是为 SharePoint 2003 / WSS 2.0 编写的,但相同的原则也适用于 SharePoint 2007 / WSS 3.0。
该错误通常类似于“无法显示或导入此 Web 部件页上的 Web 部件或 Web 窗体控件,因为它未在此站点上安全注册”。
One of the most common problems for newbies is probably code access security. A great article for troubleshooting this is Common Security Pitfalls for Web Part Developers by Jan Tielens. It was written for SharePoint 2003 / WSS 2.0 but the same principles apply in SharePoint 2007 / WSS 3.0.
The error is usually something like "A Web Part or Web Form Control on this Web Part Page cannot be displayed or imported because it is not registered on this site as safe."
我能想到的一个快速解决方案是看到您的错误消息,您在代码中的某处有一个 <%%>。 您可以尝试用以下方法包裹该部分
One Quick Solution I can think of seeing your Error message is that,you somewhere in the code have a <%%>. You can try wrapping that part with
Sharepoint 不允许对除 _layouts 文件夹中的任何内容进行内联脚本编写。 您需要将内联代码块移动到后面的代码。
Sharepoint does not allow Inline scripting for any content except that in the _layouts folder out of the box. You need to move your inline code block to the code behind.
在构造函数中放置断点并进行调试。 您可能不想在构造函数中执行任何操作。 我认为我们可能在那里执行了 RunWithElevatedPrivileges,这在将 Web 部件添加到页面时出现了问题,但如果该 Web 部件已经在页面上,则不使用它。
Put a breakpoint in the constructor and debug it. You probably don't want to do anything in the constructor. I think we may have been doing a RunWithElevatedPrivileges there and that was a problem when adding a web part to a page, but not using the web part if it was already on a page.
我在 sharepoint 中使用 webpart,但没有找到调试方法。 我只是将代码复制到另一个应用程序中进行调试
I am using webparts in sharepoint and I didn't find a way for debugging. I just copy the code into another application to debug it