Tuesday, March 1, 2011

Parser Error – SharePoint crash after deployment

Today I run into a strange problem.

I build a new version of a product and installed it – and it crashed my entire SharePoint:

image Now, I want to say that this does not happen often, but I fear it does… :)

The error reads:

Parser Error

Description: An error occurred during the parsing of a resource required to service this request. Please review the following specific parse error details and modify your source file appropriately.
Parser Error Message: This page has encountered a critical error. Contact your system administrator if this problem persists.

Source Error:

Line 1:  <%@ Page Inherits="Microsoft.SharePoint.Publishing.TemplateRedirectionPage,Microsoft.SharePoint.Publishing,Version=12.0.0.0,Culture=neutral,PublicKeyToken=71e9bce111e9429c" %> <%@ Reference VirtualPath="~TemplatePageUrl" %> <%@ Reference VirtualPath="~masterurl/custom.master" %>
Line 2: <html xmlns:mso="urn:schemas-microsoft-com:office:office" xmlns:msdt="uuid:C2F41010-65B3-11d1-A29F-00AA00C14882"><head>
Line 3: <!--[if gte mso 9]><xml>


Source File: /Pages/Default.aspx    Line: 1


Well, I started investigating this strange error message…


The weird thing was, all my SharePoint sites reported this error except for central administration – which worked just fine!


After a short research I noticed in SharePoint Log this strange message, that my web part DLL was throwing an exception that it could not load a referenced file: Microsoft.SharePoint.ApplicationPages.Administration


Well… this makes sense, since this file only exists in central administration app_bin folder.


Things started to come together. All I had done wrong was to use this dll in my code, since I had some code that was running in central admin (settings page)


Well, as soon as I removed it from my references everything started working again.


Now I have to find another way to create a settings page, since GlobalAdminPageBase base class (for central admin settings pages) is something I cannot use.


Either that or I will have to separate my settings page into another DLL (which I prefer not to do)


Well, if you get this error message – be sure to check SharePoint logs and make sure you are not using this dll!

5 comments:

Shailen Sukul said...

About using reflection in your settings page? This will remove the runtime binding the the offending dll...

Shai Petel said...

Hi Shailen,
Sure - reflection would work, except for the hussle in development and performance degradation, it should work.

Seperating the central admin settigns into a seperate class library also did the trick.

Thanks!

Anil Kumar Dintakurthi said...

is this prefferd way of delting a dll in central adimnisteation

Anil Kumar Dintakurthi said...

is this Microsoft recommendable way to do this because if i delete that dll in site all my application pages are not able run that way am asking please conform me on this

Shai Petel said...

Hi Anil,
I am not sure what you are referring to, I did not mention you should delete any file.
"I removed it from my references" means, I had a reference to it in *my* visual studio project, and I removed the reference.
I didn't delete the file from the server.
Sorry for the confusion, please do not delete or modify any of the built-in system files on your server. That would not be supported/recommended.