hicham's profilehicham Boutaleb <C'est ...PhotosBlogNetwork Tools Help

Blog


    June 30

    HOW CAN YOU DEBUG YOUR WEB PARTS

    Whenever an error occurs in a web part, Microsoft Office SharePoint Server 2007 shows a generic error message. If
    you want to see a detailed error message, you should open the web.config file of the SharePoint web application
    that contains the web part, locate the <SafeMode> node, and set the CallStack attribute to true. If you want to
    be able to see more than a generic server error message, you should locate the <customErrors> element and set
    the mode attribute to Off.
    You do not need to set the debug property of the <compilation> element to true to be able to debug a web
    part. This setting tells ASP.NET to generate symbol tables (.pdb files) when compiling pages. Since your web part
    code is contained in an assembly, you can debug the necessary .pdb files by building a Debug version of the web
    part library. When the debug symbols are present, you can debug web parts by attaching to the process (an
    instance of w3wp.exe).
    However, if you want to be able to debug web parts by letting Visual Studio 2005 auto-attach to the process,
    you do need to set the debug attribute of the <compilation> attribute to true. In that case, you also need to raise
    the trust level for the SharePoint web application containing your web part to WSS_Medium or greater.
    Be careful: setting the debug attribute of the <compilation> attribute to true has an undesirable side effect.
    Every time you run the web part library project, a .bak copy of your web application’s web.config file is created.
    The blog post “Debugging web parts – a full explanation of the requirements,” written by Maurice Prather,
    discusses the previously discussed techniques in detail. The blog post can be found at the following location:
    http://www.bluedoglimited.com/SharePointThoughts/ViewPost.aspx?ID=60.
    Whenever you are auto-attaching to a process in Visual Studio 2005, the web server is restarted in order to
    recycle the w3wp.exe process hosting your web part. This is overkill. Instead, it is much faster if you just restart the
    application pool that hosts the SharePoint web application containing your web part and then manually attach to the
    process hosting your web part. You can restart the application pool via iisapp.vbs (located in the [drive letter]:\windows\
    system32 folder) using the following command:
    iisapp.vbs /a “[application pool name]” /r
    You can make attaching to this process even easier by installing the Debugger feature for SharePoint, created
    by Jonathan Dibble. This feature adds a new menu item to the Site Actions menu of a SharePoint site and is
    described in detail in the blog post “Debugger ‘Feature’ for SharePoint ” at http://blogs.msdn.com/
    sharepoint/archive/2007/04/10/debugger-feature-for-sharepoint.aspx. The feature can be
    downloaded from the SharePoint 2007 Features site at CodePlex (http://www.codeplex.com/features/
    Release/ProjectReleases.aspx?ReleaseId=2502). This list of free SharePoint features is maintained by
    Scot Hillier.

    Mots clés Technorati : ,,,,

    Comments

    Please wait...
    Sorry, the comment you entered is too long. Please shorten it.
    You didn't enter anything. Please try again.
    Sorry, we can't add your comment right now. Please try again later.
    To add a comment, you need permission from your parent. Ask for permission
    Your parent has turned off comments.
    Sorry, we can't delete your comment right now. Please try again later.
    You've exceeded the maximum number of comments that can be left in one day. Please try again in 24 hours.
    Your account has had the ability to leave comments disabled because our systems indicate that you may be spamming other users. If you believe that your account has been disabled in error please contact Windows Live support.
    Complete the security check below to finish leaving your comment.
    The characters you type in the security check must match the characters in the picture or audio.

    To add a comment, sign in with your Windows Live ID (if you use Hotmail, Messenger, or Xbox LIVE, you have a Windows Live ID). Sign in


    Don't have a Windows Live ID? Sign up

    Trackbacks

    The trackback URL for this entry is:
    http://hichamboutaleb.spaces.live.com/blog/cns!B117187DC598CA5A!157.trak
    Weblogs that reference this entry
    • None