我們有一些針對MOSS農場建立的解決方案,其中一個包含計時器作業。這份工作幾個月來一直很好。最近,管理員向服務器場徵用了另一臺服務器,我們的計時器作業自動開始在這臺新機器上運行。只要這個開關發生,我們的計時器作業開始產生下面的錯誤(在SP日誌中找到這個錯誤)。MOSS 2007網站在農場類型初始值設定項例外
起初我以爲這是一個供應問題,但是它之前的機器上的計時器服務和新服務器在同一個域帳戶下運行。在站點集合中,只在其中一個站點/網站(以下代碼段)中循環站點列表時,似乎失敗。我知道這個域帳戶可以訪問這個帳戶,因爲它可以在同一個帳戶下的另一個框中工作。有沒有人有任何想法,爲什麼這個神祕的錯誤發生?或者如果需要在這臺新機器上執行任何特殊過程以確保它對MOSS場中的所有數據庫都有適當的ACL?
代碼:
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)
例外:
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)
異常的類型是什麼? – 2009-04-21 14:16:49
這是一個TypeInitializerException異常。它似乎源於對內容數據庫的SQL級別訪問問題。但正如我上面所說的那樣,計時器服務在具有足夠特權的域帳戶下運行。我知道這是因爲我使用該帳戶登錄到SQL管理工作室,並能夠訪問內容數據庫中的所有內容。 – James 2009-04-21 15:45:06
任何幸運的嘗試調試或尋找內部異常?這就是真實的信息。 – 2009-04-23 20:24:23