我有一个代码,可以使用 CSOM 对项目进行一些简单的更改:
projContext.Load(this.projContext.Projects, pj => pj.Where(p => p.Id == projId));
projContext.ExecuteQuery();
var proj = projContext.Projects.SingleOrDefault(p => p.Id == projId);
var draft = proj.CheckOut();
projContext.Load(draft, p => p.Owner);
projContext.ExecuteQuery();
draft.Owner = managerUser;
var tasks = draft.Tasks;
projContext.Load(tasks, tsk => tsk.IncludeWithDefaultProperties(t => t.Id, t => t.StatusManager));
projContext.ExecuteQuery();
var newTaskId = Guid.NewGuid();
var newTask = new PS.TaskCreationInformation {
Id = Guid.NewGuid(),
Name = "New task",
StatusManager = managerUser,
};
tasks.Add(newTask);
draft.Assignments.Add(new PS.AssignmentCreationInformation {
TaskId = newTaskId,
ResourceId = managerId,
});
var qJob = draft.Update();
var jobState = projContext.WaitForQueue(qJob, TimeoutSeconds);
在开发环境中运行良好,但在生产环境中队列中的更新作业因内部异常而失败。这种情况仅发生在以某种方式创建的项目中:
这是队列错误:
您的项目更新作业失败。其当前状态为失败。当时是 0 完全的。它于 12/08/2022 16:24:05 进入队列 错误 ID:9133 错误 ID:26000
详细错误如下 – 将其发送给管理员以获取更多详细信息 故障排除。
<?xml version="1.0" encoding="utf-16"?> <errinfo><general><class name="Project"><error id="9133" name="ProjectSchedulingEngineException" uid="2d0b12df-fb76-ed11-95ef-005056b6871f" exception="System.ServiceModel.CommunicationObjectAbortedException: The communication object, System.ServiceModel.Channels.ServiceChannel, cannot be used for communication because it has been Aborted. Server stack trace: at System.ServiceModel.Channels.CommunicationObject.ThrowIfDisposedOrNotOpen() at System.ServiceModel.Channels.ServiceChannel.Call(String action, Boolean oneway, ProxyOperationRuntime operation, Object[] ins, Object[] outs, TimeSpan timeout) at System.ServiceModel.Channels.ServiceChannelProxy.InvokeService(IMethodCallMessage methodCall, ProxyOperationRuntime operation) at System.ServiceModel.Channels.ServiceChannelProxy.Invoke(IMessage message) Exception rethrown at [0]: at Microsoft.Office.Project.Server.BusinessLayer.ProjectEngineUpdate.UpdateProjectWithPCS(IPlatformContext context, ProjectDataSet dataset, Guid projectUid, Guid sessionUid, Boolean inVisibilitySyncMode, Boolean skipEventHandlers, Boolean skipPostSSPUpdate) at Microsoft.Office.Project.Server.BusinessLayer.ProjectMain.HandleProject2(MessageContext mContext, ProjectDataSet dataset, Guid projectUid, Guid sessionUid, Boolean inVisibilitySyncMode)" /></class><class name="Queue"><error id="26000" name="GeneralQueueJobFailed" uid="2e0b12df-fb76-ed11-95ef-005056b6871f" JobUID="c3f6fcdb-fb76-ed11-95ef-005056b6871f" ComputerName="7e53cc63-ebbd-427f-bde0-d1db317abacd" GroupType="ProjectUpdate" MessageType="ProjectUpdate2Message" MessageId="1" Stage="" CorrelationUID="704180a0-0676-40da-abac-d2a039c9acc3" /></class></general> </errinfo>
您可以执行以下操作:
- 尝试使用错误 ID、错误 XML 进行故障排除。
- 请联系管理员并提供您的 jobID (db6df25a-d4c1-4631-b7a1-2e7aae9f5c16) 和错误 XML。
尝试在用于开发的 Project Server 上重现该问题,但还没有成功。看起来微软对这个问题负有全部责任,但也许有人知道解决方法?
这个问题有运气吗?我有同样的问题。当项目很大、有 5000 多个任务和大量依赖项时,就会出现这个特殊问题。尝试了很多不同的方法,但似乎没有任何效果。