Category: Install

Dealing with corrupt WebConfigModification entries.

By , June 30, 2011 3:38 pm

Recently, I came across a problem.  I had created a new SharePoint Designer Custom Action and I created a feature solution package to deploy it to the production farm.  In testing it in a dev environment, I kept getting errors from the code I was using to make the appropriate web.config entries.  A custom SPD workflow action requires an ‘authorizedType’ entry in the web.config.  I have code in my feature receiver that will create a WebConfigModification entry in the WebConfigModifications collection and then use the SPService to apply the modifications.  (MSDN).  My problem was that someone had created a corrupt entry in the collection and it kept erroring out before executing my change.  It took a little understanding of how this works to find the solution to the problem.

The WebConfigModifications are a persisted object. That means that they remain until they are operated on.  In essence, it is a persisted queue.  Each entry is related to a SPWebApplication and added to the queue.  To remove the offending entry, I had to identify which web application the entry was registered with.  I just started going through every web application in my farm.  You could iterate through each application but in my case, I just hard-coded the URL for each application.  Here is the code that I used to clear the corrupt entries:


string siteUrl = @"http://localhost:44689";
SPSite site = new SPSite(siteUrl);
SPWebApplication webApp = site.WebApplication;
webApp.WebConfigModifications.Clear();
webApp.Update();
SPWebService service = SPWebService.ContentService;
service.WebConfigModifications.Clear();
service.Update();
service.ApplyWebConfigModifications();

I created a console app and put the code above in the Main() method. I kept executing the code using different web application URL’s until it executed without any error. Once I didn’t get an error, I was pretty sure that I had cleared the bogus entry. The next time I ran my feature code, it executed flawlessly!

A couple of notes. Obviously, this code is meant to be executed on the server and not a client. My dev machine has a single WFE. I would think that the best place to execute this would be on the same machine where Central Admin resides. Also – this was for a problem on a MOSS (WSS3) install. I am sure that it works the same in SharePoint 2010.

You can find the correct URL’s in IIS for each web application on your server. In my case, it was a shared development machine so there were many web applications executing under many different ports.

Feature and Code Depreciation in SharePoint 2010

By , January 25, 2010 2:38 pm

SharePoint Joel (Joel Olesen) has a good post in preparing for Code and Feature Depreciation in SP2010.

Understanding Feature and Code Depreciation for Upgrade to SharePoint 2010

SharePoint Saturday – Kansas City

By , December 13, 2009 11:53 am

I presented “What I Wish I Knew Before I Implemented SharePoint” at SharePoint Saturday in Kansas City on 12/12/2009.  This is a 100-level presentation that is meant to be a general overview of the process of implementing SharePoint.

I enjoyed my time there and for those in my session, you can download the slide-deck here.

Also, for reference, here are a list of links that I referenced during the session.

SharePoint Shepherds Guide for End Users

EndUserSharePoint.com

SharePoint Deployment Planning Services

SharePoint Website at Microsoft

WSSDemo.com

Slide Deck: SharePoint Saturday KC 2009 I Wish Id Known That

You can also get my contact information from my tag.

********  UPDATE ***********

I was informed that my tag was password protected.  Lo-and-behold, it was and so I created a new tag.  This one should not be password protected.

******** UPDATE ************

Dave Petersen Contact

SharePoint Install Smooth Sailing!

By , September 25, 2009 1:52 pm

This is a great reference for when you are installing SharePoint. A great reference for all of the different User accounts needed by SharePoint.

Best Practice for User Accounts When Installing MOSS

Panorama Theme by Themocracy