Sitecore azure无法启动

时间:2014-09-09 09:13:28

标签: c# azure sitecore sitecore7 sitecore-azure

我们在将sitecore应用程序部署到Azure环境时遇到问题。更新Cloud Service后无法启动,提供信息: Unhandled Exception: Microsoft.ApplicationServer.Caching.DataCacheException。在WaIISHost进程日志中,我发现了这样的错误:

    0 : [00003180:00000006, 2014/09/09 06:35:16.89, ERROR] Unhandled exception: IsTerminating 'True',  Message 'System.TimeoutException: We waited for 'Boolean <CreateSymbolicLink>b__1()' that didn't finish within 00:00:30. 
   at System.Environment.GetStackTrace(Exception e, Boolean needFileInfo)
   at System.Environment.get_StackTrace()
   at Sitecore.Azure.Sys.Retryer.Do.Until(Func`1 predicate, TimeSpan timeout)
   at RoleRootConfigurator.CreateSymbolicLink(String relativePathToAppRoot, DirectoryInfo localResourceDir)
   at WebRole.RoleRootConfigurator.ConfigureSymbolicLinksForApproot(DirectoryInfo localResourceDir)
   at WebRole.OnStart()
   at Microsoft.WindowsAzure.ServiceRuntime.RoleEnvironment.InitializeRoleInternal(RoleType roleTypeEnum)
   at Microsoft.WindowsAzure.ServiceRuntime.Implementation.Loader.RoleRuntimeBridge.<InitializeRole>b__0()
   at System.Threading.ExecutionContext.RunInternal(ExecutionContext executionContext, ContextCallback callback, Object state, Boolean preserveSyncCtx)
   at System.Threading.ExecutionContext.Run(ExecutionContext executionContext, ContextCallback callback, Object state, Boolean preserveSyncCtx)
   at System.Threading.ExecutionContext.Run(ExecutionContext executionContext, ContextCallback callback, Object state)
   at System.Threading.ThreadHelper.ThreadStart()
   at Sitecore.Azure.Sys.Retryer.Do.Until(Func`1 predicate, TimeSpan timeout)
   at WebRole.RoleRootConfigurator.CreateSymbolicLink(String relativePathToAppRoot, DirectoryInfo localResourceDir)
   at WebRole.RoleRootConfigurator.ConfigureSymbolicLinksForApproot(DirectoryInfo localResourceDir)
   at WebRole.OnStart()
   at Microsoft.WindowsAzure.ServiceRuntime.RoleEnvironment.InitializeRoleInternal(RoleType roleTypeEnum)
   at Microsoft.WindowsAzure.ServiceRuntime.Implementation.Loader.RoleRuntimeBridge.<InitializeRole>b__0()
   at System.Threading.ExecutionContext.RunInternal(ExecutionContext executionContext, ContextCallback callback, Object state, Boolean preserveSyncCtx)
   at System.Threading.ExecutionContext.Run(ExecutionContext executionContext, ContextCallback callback, Object state, Boolean preserveSyncCtx)
   at System.Threading.ExecutionContext.Run(ExecutionContext executionContext, ContextCallback callback, Object state)
   at System.Threading.ThreadHelper.ThreadStart()'

我们已根据Sitecore Developers编写的代码创建了自定义WebRole。以下是负责创建符号链接的代码:

public void ConfigureSymbolicLinksForApproot(DirectoryInfo localResourceDir)
{
    if (RoleEnvironment.IsEmulated)
        return;
    Trace.TraceInformation(" -- Configure app root starting...");
    this.CreateSymbolicLink("temp", localResourceDir);
    this.CreateSymbolicLink("App_Data/debug", localResourceDir);
    this.CreateSymbolicLink("App_Data/diagnostics", localResourceDir);
    this.CreateSymbolicLink("App_Data/indexes", localResourceDir);
    this.CreateSymbolicLink("App_Data/logs", localResourceDir);
    this.CreateSymbolicLink("App_Data/packages", localResourceDir);
    this.CreateSymbolicLink("App_Data/viewstate", localResourceDir);
    this.CreateSymbolicLink("App_Data/MediaCache", localResourceDir);
    this.CreateSymbolicLink("App_Data/Submit_Queue", localResourceDir);
}

private void CreateSymbolicLink(string relativePathToAppRoot, DirectoryInfo localResourceDir)
{
    DirectoryInfo appRootDir = new DirectoryInfo(Path.Combine(this.AppRoot.FullName, relativePathToAppRoot));
    Do.ThisOnce((Action)(() => RmDir.RemoveDir(appRootDir))).Until((Func<bool>)(() => !Directory.Exists(appRootDir.FullName)));
    DirectoryInfo tempLocalResourceDir = new DirectoryInfo(Path.Combine(localResourceDir.FullName, relativePathToAppRoot));
    Do.ThisOnce(new Action(tempLocalResourceDir.CreateIfNotExists)).Until((Func<bool>)(() => Directory.Exists(tempLocalResourceDir.FullName)));
    Do.ThisOnce((Action)(() => MkLink.CreateLink(appRootDir, tempLocalResourceDir))).WithTracePing("Waiting for '{0}' to be created as symbolic link in app root", (object)appRootDir.FullName).Until((Func<bool>)(() => Directory.Exists(appRootDir.FullName)));
}

我还在事件查看器中找到了这样的信息:

Faulting application name: CacheService.exe, version: 1.0.5137.0, time stamp: 0x52304f01
Faulting module name: KERNELBASE.dll, version: 6.2.9200.16864, time stamp: 0x531d34d8
Exception code: 0xe0434352
Fault offset: 0x0000000000047b8c
Faulting process id: 0x1e80
Faulting application start time: 0x01cfcc0ca7dac7a3
Faulting application path: F:\plugins\Caching\CacheService.exe
Faulting module path: D:\Windows\system32\KERNELBASE.dll
Report Id: ee6a3966-37ff-11e4-93f6-00155d67d4ca
Faulting package full name: 
Faulting package-relative application ID: 

Application: CacheService.exe
Framework Version: v4.0.30319
Description: The process was terminated due to an unhandled exception.
Exception Info: Microsoft.ApplicationServer.Caching.DataCacheException
Stack:
   at Microsoft.ApplicationServer.Caching.AzureCommon.AzureUtility.ProcessException(System.Exception)
   at Microsoft.ApplicationServer.Caching.Colocatedservice.CacheService.<OnStart>b__0(System.Object)
   at System.Threading.QueueUserWorkItemCallback.System.Threading.IThreadPoolWorkItem.ExecuteWorkItem()
   at System.Threading.ThreadPoolWorkQueue.Dispatch()

基于此,我尝试使用由Sitecore提供的nuget更新Windows AzureCache库,或者将其置于Azure SDK 2.2文件夹中,但没有任何更改。任何帮助都会感激不尽。

1 个答案:

答案 0 :(得分:2)

Jacbar。

根据初始异常,在为以下目录创建Windows Symbolic Links期间部署过程失败:

  • \ temp中
  • \程序App_Data \调试
  • \程序App_Data \诊断
  • \程序App_Data \索引
  • \程序App_Data \日志
  • \程序App_Data \包
  • \程序App_Data \视图状态
  • \程序App_Data \ MediaCache

Sitecore Azure使用此技巧来避免在具有1.5 GB(有限为1 GB)的有限大小的虚拟机上溢出最后一个磁盘(通常是磁盘F:/)。此磁盘用于保留您部署到PaaS的ASP.NET Web应用程序。

正如.NET Reflector向我显示的那样, Sitecore.Azure.Sys.Retryer.Do.Until(Func谓词)方法使用等于30秒的硬编码超时。在您的情况下,30秒还不足以删除F:\ approot(aka Website)文件夹下的旧目录,在Azure Local Storage Resources中创建一个新目录并使用Symbolic Links链接它。

我建议您使用Sitecore Support打开支持服务单,以找出解决30秒硬编码值的最佳方法。

祝福,Oleg