Navigation

Search

Categories

On this page

Debugging a Web Part
Creating a Data Layer
Creating a User Control for WSS
The application-specific permission settings do not grant Local Activation permission for the COM Server application with CLSID - WSS / SharePoint 2007 Server Issues

Archive

Blogroll

Disclaimer
The opinions expressed herein are my own personal opinions and do not represent my employer's view in anyway.

RSS 2.0 | Atom 1.0 | CDF

Send mail to the author(s) E-mail

Total Posts: 112
This Year: 50
This Month: 0
This Week: 0
Comments: 0

Sign In

 Thursday, July 24, 2008
Thursday, July 24, 2008 8:59:09 PM (Eastern Standard Time, UTC-05:00) ( )

I've been learning how to develop parts for WSS 3.0 and have found that debugging them is a real pain.  I picked up this tip from SharePoint Development and Programming FAQ which has proven helpful.

Problem

You receive “The "yourWebPartName" Web Part appears to be causing a problem” or a generic error message when developing a web part.

Cause

Exceptions are caught by SharePoint and a friendly error message is displayed instead of a stack trace.

Resolution

To configure SharePoint to display the full exception needed for debugging make the following changes to your SharePoint site’s web.config file (typically located in \Inetpub\wwwroot\wss\VirtualDirectories\yoursite).

· Find: <SafeMode CallStack="false" />

· Replace with: <SafeMode CallStack="true" />

· Find: <customErrors mode="On" />

· Replace with: <customErrors mode="Off" />

· Find: <compilation debug="false" />

· Replace with: <compilation debug="true" />

 Wednesday, July 16, 2008
Wednesday, July 16, 2008 12:35:23 PM (Eastern Standard Time, UTC-05:00) ( )
Imports System
Imports System.Data
Imports System.Data.SqlClient
Imports System.Web.Configuration
Imports System.Collections.Generic

Public Class AwesomeDataLayer
    Private Shared ReadOnly _connectionString As String
Private Sub Page_Load()
        lblMovieTitle.Text = GetMovieTitle().ToString()
End Sub
       Public Shared Function GetMovieTitle() As String
        Dim result As String = String.Empty
        Dim con As New SqlConnection(_connectionString)
        Dim cmd As New SqlCommand("GetMovieTitle", con)
        cmd.CommandType = CommandType.StoredProcedure
        Using con
            con.Open()
            Dim reader As SqlDataReader = cmd.ExecuteReader()
            If reader.Read() Then
                result = CType(reader("Title"), String)
            End If
        End Using
        Return result
    End Function

    Shared Sub New()
        _connectionString = WebConfigurationManager.ConnectionStrings("MyDatabase").ConnectionString
    End Sub

End Class
 Monday, July 07, 2008
Monday, July 07, 2008 11:17:01 AM (Eastern Standard Time, UTC-05:00) ( )

I frequently create User Controls in our WSS 3.0 environment use SmartPart to deploy them. 

Below is an example of a user control not using code-behind.

LastBAUserLogin.ascx

<%@ Control Language="VB" ClassName="LastBAUserLogin" %>
<%@ Import Namespace="System.Data" %>
<%@ Import Namespace="System.Data.SqlClient" %>
<%@ Import Namespace="System.Web.Configuration" %>
<%@ Import Namespace="System.Web.UI.UserControl" %>

<script runat="server">
</script>

<asp:UpdatePanel ID="MyUpdatePanel" runat="server">
       <ContentTemplate>
       </ContentTemplate>
 </asp:UpdatePanel>

This is an example utilizing code-behind

staff.directory.ascx

<%@ Control Language="VB" AutoEventWireup="false" codeFile="staff.directory.ascx.vb" Inherits="StaffDirectory" %>

<asp:UpdatePanel ID="MyUpdatePanel" runat="server">
      <ContentTemplate>
      </ContentTemplate>
</asp:UpdatePanel>

staff.directory.ascx.vb

Partial Class StaffDirectory
Inherits System.Web.UI.UserControl

End Class

 Tuesday, July 01, 2008
Tuesday, July 01, 2008 12:12:34 PM (Eastern Standard Time, UTC-05:00) ( )

You may see this error - more than once - when working with your Microsoft Office SharePoint Server (MOSS) 2007 or WSS 3.0 deployment. This often happens after you have applied an upgrade to an existing deployment. You may begin to see a lot of these errors pop up in the SYSTEM event log a:

Event Type:    Error
Event Source:    DCOM
Event Category:    None
Event ID:    10016
Date:        7/1/2008
Time:        9:49:50 AM
User:        NT AUTHORITY\NETWORK SERVICE
Computer:    TCLPRODAPP1
Description:
The application-specific permission settings do not grant Local Activation permission for the COM Server application with CLSID
{61738644-F196-11D0-9953-00C04FD919C1}
to the user NT AUTHORITY\NETWORK SERVICE SID (S-1-5-20).  This security permission can be modified using the Component Services administrative tool

The error CLSID is followed by a class ID for the DCOM+ application that the service account trying to activate that application does not have permission to activate it.

This is the fix that worked for us.

Copy the GUID following the CLSID above, and Start-->Run-->regedit

Edit-->Find and paste in the GUID. It'll stop at the application entry - and you will want to note the application name on the right side pane. In this example, it was the IIS WAMREG admin service that popped up.

Now, open Component Services (typically, from the server - Start-->Administrative Tools-->Component Services), expand Component Services, Computers, My Computer, DCOM Config. Scroll down and find the application (IIS WAMREG in this case). Right-Click-->Properties and select the Security tab. You'll have some options here - the first block Launch and Activation Permissions - ensure that the Customize radio button is selected, and click Edit. Now, add your service account - giving it launch and activate - and in some requirements - remote launch / activate permission.

Restart IIS.