Sharepoint 2010 解決DFWP - Unable to display this Web Part 的問題


參考這個:
 
簡言之,微軟為了防止dos攻擊,在2011年5~8月份不知道哪個patch中將WebPart的xsl轉換時間限制為1秒之內,如果超時就不顯示該WebPart而給出如下錯誤消息:
"Unable to display this Web Part. To troubleshoot the problem, open this Web page in a Microsoft SharePoint Foundation-compatible HTML editor such as Microsoft SharePoint Designer. If the problem persists, contact your Web server administrator."
 
通常這種情況發生在字段很多(比如超過30個子段)的定制Form之上。
 
通常是第一次訪問時出現這個錯誤,刷新頁面后就正常顯示了,估計是因為有緩存的緣故,如果不持續訪問,過一段時間又會出現這個錯誤,估計是緩存失效了。
 
微軟在這個KB中給出了解決方案:
1. 簡化xls的代碼,從而加快解析速度,於是不超時正常顯示 (xsl不是很好寫啊)
2. 使用infopath form替代默認的Web Form (好像需要sharepoint企業版)
3. 繼承系統自帶的DataFormWebPart,創建並應用自己的WebPart(看似復雜實則最可行)
1) Sub class the DataForm Web Part. Override the following methods. Then Deploy the assembly.
Example:
  public class customDFWP : DataFormWebPart
    {
        public override bool IsGhosted
        {
            get
            {
                return true;
            }
        }
        public override bool CanHaveServerControls
        {
            get
            {
                return true;
            }
        }
    }

2) Add a safe control entry to the web.config
Example: <SafeControl Assembly="customDFWP, Version=1.0.0.0, Culture=neutral, PublicKeyToken=963f869a440db619" Namespace="customDFWP" TypeName="*" Safe="True" AllowRemoteDesigner="True" SafeAgainstScript="False"/>

3) Add the following to the <tagMapping> element of the web.config
Example: <add tagType="Microsoft.SharePoint.WebPartPages.DataFormWebPart, Microsoft.SharePoint, Version=14.0.0.0, Culture=neutral, PublicKeyToken=71e9bce111e9429c" mappedTagType="customDFWP.customDFWP, customDFWP, Version=1.0.0.0, Culture=neutral, PublicKeyToken=963f869a440db619" />

4) Register the assembly on the form page.
Example: <%@ Register tagprefix="customDFWP" namespace="customDFWP" assembly="customDFWP, Version=1.0.0.0, Culture=neutral, PublicKeyToken=963f869a440db619" %>

5) On the form page find <WebPartPages:DataFormWebPart > and replace it with the new custom tag.
Example:<customDFWP:customDFWP>
 
更多參考:






免責聲明!

本站轉載的文章為個人學習借鑒使用,本站對版權不負任何法律責任。如果侵犯了您的隱私權益,請聯系本站郵箱yoyou2525@163.com刪除。



 
粵ICP備18138465號   © 2018-2025 CODEPRJ.COM