MOSS 2007 site in farm type initializer exception

We have some solution that we built against the MOSS farm, one of which includes a timer job. This job works great for months. Recently, the administrator added another server to the farm, and our timer job started automatically on this new machine. As soon as this switch occurred, our timer job began to produce an error below (found in the SP logs).

At first, I thought this was a problem, but the timer service on the machine where it worked before, and the new one, worked under the same domain account. It doesn't seem to work, looping the list of sites in the site collection on only one of the sites / websites (code snippet below). I know that this domain account has access to this because it works in a different field under the same account. Does anyone have any ideas on why this mysterious error occurs? Or if you need to perform some special procedure on this new machine to ensure that it has the proper ACL for all databases in the MOSS farm?

Code:

public static void Main(string[] args)
{
    SPSecurity.RunWithElevatedPrivileges(delegate() { setInputParameters(); }); 
}

private static void setInputParameters()
{
    SPFarm farm = SPFarm.Local;
    SPWebService service = farm.Services.GetValue<SPWebService>("");
    foreach (SPWebApplication webApp in service.WebApplications) 
    { 
        foreach (SPSite siteCollection in webApp.Sites) 
        {   
            using(siteCollection)
            {
                siteCollection.CatchAccessDeniedException = false; 

                try 
                {
/* Here is the line that it fails on */
                     foreach (SPWeb web in siteCollection.AllWebs) 

An exception:

The Execute method of job definition LMSDataImport (ID 4b37b285-ef8a-407c-8652-391639449790) threw an exception. 
More information is included below.  
The type initializer for 'Microsoft.SharePoint.Administration.SPPersistedObjectCollection`1' threw an exception.

Exception stack trace:    

at Microsoft.SharePoint.Administration.SPPersistedObjectCollection`1.get_BackingList()     
at Microsoft.SharePoint.Administration.SPPersistedObjectCollection`1.GetEnumerator()     
at Microsoft.SharePoint.Administration.SPAlternateUrlCollectionManager.LookupAlternateUrl(Uri canonicalRequestUri)     
at Microsoft.SharePoint.Administration.SPAlternateUrl.LookupCore(Uri uri, SPFarm farm)     
at Microsoft.SharePoint.Administration.SPWebApplication.Lookup(SPFarm farm, Uri requestUri, Boolean fallbackToHttpContext, SPAlternateUrl& alternateUrl, SiteMapInfo& hostHeaderSiteInfo, Boolean& lookupRequiredContext)     
at Microsoft.SharePoint.SPSite..ctor(SPFarm farm, Uri requestUri, Boolean contextSite, SPUserToken userToken)     
at Microsoft.SharePoint.SPSite..ctor(SPFarm farm, Uri requestUri, Boolean contextSite)     
at Microsoft.SharePoint.Administration.SPSiteCollection.get_Item(String strSiteName)     
at Microsoft.SharePoint.Administration.SPSiteCollection.get_Item(Int32 index)     
at Microsoft.SharePoint.Administration.SPSiteCollection.ItemAtIndex(Int32 iIndex)     
at Microsoft.SharePoint.SPBaseCollection.SPEnumerator.System.Collections.IEnumerator.get_Current()     
at LMSDataImporter.setInputParameters()     
at Microsoft.SharePoint.SPSecurity.CodeToRunElevatedWrapper(Object state)     
at Microsoft.SharePoint.SPSecurity.<>c__DisplayClass4.<RunWithElevatedPrivileges>b__2()     
at Microsoft.SharePoint.Utilities.SecurityContext.RunAsProcess(CodeToRunElevated secureCode)     
at Microsoft.SharePoint.SPSecurity.RunWithElevatedPrivileges(WaitCallback secureCode, Object param)     
at Microsoft.SharePoint.SPSecurity.RunWithElevatedPrivileges(CodeToRunElevated secureCode)     
at Axian.AxianCalendar.LMSDataImporter.Main(String[] args)     
at Microsoft.SharePoint.Administration.SPTimerJobInvoke.Invoke(TimerJobExecuteData& data, Int32& result)    
+3
source share
4 answers

DLL SharePoint, , ? catch TypeInitializationException , .

+4

, , , :

SharePoint ?

, .

+3

(NLB). SharePoint , , , NLB . . . , . , NLB

+2

init , .ctor ( , , ). InnerException - ? , , Microsoft.SharePoint.Administration.SPPersistedChildCollection InitializeFromDatabse.

sharepoint ( ) , . - , ULS http://www.codeplex.com/features

stacktrace SPAlternateUrl, , , ( ) - , .

You can filter the ULS logs by source.

-Oisin

+1
source

Source: https://habr.com/ru/post/1706335/


All Articles