SharePoint Sharpener

Obsessively Sharpening SharePoint

Posts Tagged ‘sharepoint 2007

Inserting a SharePoint Web Part Generates an Internal Server Error (500)

leave a comment »

One of my clients recently reported some strange behaviour by their SharePoint 2007 publishing site.

Inserting a web part would sometimes generate an internal server error (status code 500). You’ll notice the word “sometimes” which really isn’t something you want to hear when trying to diagnose SharePoint problems 🙂

Anyway, it turned out that the described behaviour is entirely reproducible as it is only in certain web part zones that the problem occurs – but it will always happen in those particular zones if a web part is attempted to be inserted.

So, what is the pattern? Have a look at the highlighted part of this screenshot:

Screenshot: 500 Internal server error

The screenshot is in fact the Insert Web Part pop-up window. The key to solving the problem is in the ZoneDisplayName part of the querystring. It contains an escaped extended character, in this case the Danish letter “ø”, because the name of the zone is “Højre kolonne” (Right column).

The error does not occur when a web part is inserted into a zone with a name that doesn’t contain extended characters, such as “Venstre kolonne” (Left column).

The solution

Realising the SharePoint server lives behind an ISA Server I knew where to look first. The easiest way to bypass the ISA is to log into the SharePoint server with Remote Desktop, fire up a browser and try to insert a web part in the same zone. So that’s what I did.

Boom. No problems, the web part could be inserted.

The good news is that the problem can be alleviated by making a few changes to the ISA configuration. See this KB for more info:

Written by Thomas Sondergaard

March 30, 2011 at 2:12 pm

Solution: Accessing SharePoint Site or WebApp via Code Returns Null

with 2 comments

A colleague of mine recently developed a timer job for SharePoint. The job worked fine on his developer and test machines but when he tried to activate it in the pre-production environment things went downhill.

An exception was thrown as soon as the timer job attempted to access the web application to add the timer job, ie. in this line of code:


The exception thrown was the good old “Object reference not set to an instance of an object” and further investigation showed that SPContext returned Null. Accessing the web application by referencing it directly (eg. SPWebApplication wA = SPWebApplication.Lookup(new Uri(http://site)); ) did not make a difference.

Coincidentally, the following error showed up in the event log: “Error in the site data web service”. This error mostly surfaces when SharePoint search chokes in a 32 bit environment due to large lists or inefficient use of memory capacity (heap fragmentation).

The solution

Restarting the below-mentioned services (net start/stop) fixed the problems for us:

net stop "Office SharePoint Server Search"
net start "Office SharePoint Server Search"
net stop "Windows SharePoint Services Search"
net start "Windows SharePoint Services Search"
net stop "Windows SharePoint Services Administration"
net start "Windows SharePoint Services Administration"
net stop "Windows SharePoint Services Timer"
net start "Windows SharePoint Services Timer"
iisreset /noforce

Source: Technet.

Written by Thomas Sondergaard

April 15, 2010 at 3:16 pm