Episerver计划作业失败(计划程序服务)

时间:2013-06-26 16:19:27

标签: episerver

我们的预定作业自昨天开始失败,并显示以下错误消息:

  

CustomUpdate.Execute - System.NullReferenceException:对象引用   未设置为对象的实例。在   System.Web.Security.Roles.GetRolesForUser(String username)at   EPiServer.Security.PrincipalInfo.CreatePrincipal(String username)

预定作业使用匿名执行并使用以下调用以编程方式登录:

if (PrincipalInfo.CurrentPrincipal.Identity.Name == string.Empty)
{
     PrincipalInfo.CurrentPrincipal = PrincipalInfo.CreatePrincipal(ApplicationSettings.ScheduledJobUsername);
}

我在Episerver.Security中调用PrincipalInfo.CreatePrincipal调用并注意到PrincipalInfo.CreatePrincipal调用System.Web.Security.Roles.GetRolesForUser(用户名)和Roles.GetRolesForUser(用户名)返回空字符串数组。 代码明智或服务器上没有更改(更新等)。 我检查了用于运行任务的用户名是否在数据库中,并且具有与之关联的角色。 我检查了applicationname是否设置正确并与用户关联 如果我使用相同的用户手动运行作业,它执行没有问题(我知道手动运行作业和使用调度程序之间有区别) 我也试过创建一个新用户,但也没用。 有没有人遇到过相同或类似的问题?有任何想法如何解决这个问题?

1 个答案:

答案 0 :(得分:1)

我终于发现了一个问题 - 运行多个工作进程的应用程序池(在我的实例中我有两个工作进程)。一旦我将工作流程限制设置为1,一切都开始重新开始。