我有一个异步任务,我运行和网站部署使用服务结构。即使我有完整的堆栈,我也无法确定这个问题。我不知道服务结构,所以任何帮助将不胜感激。
await ServiceFabricClient.functionname(some parameters).ConfigureAwait(false)
异常的堆栈是
System.AggregateException: at Microsoft.ServiceFabric.Services.Communication.Client.ServicePartitionClient`1+<InvokeWithRetryAsync>d__24`1.MoveNext (Microsoft.ServiceFabric.Services, Version=6.0.0.0, Culture=neutral) Inner exception System.InvalidOperationException handled at Microsoft.ServiceFabric.Services.Communication.Client.ServicePartitionClient`1+<InvokeWithRetryAsync>d__24`1.MoveNext:
谢谢你Nardu发布您的建议作为帮助其他社区成员的答案。
而不是:
await restoreClient.RestoreAsync(id, name).ConfigureAwait(false);
试试这个:
var workerId = StartANewWorker()
JobState jobState;
do {
//poll for the status of the new worker
var workerStatus = GetStatusOfTheWorker(workerId);
await Task.Delay(1000).ConfigureAwait(false);
if (workerStatus == Failed) {
throw new Exception("Something went wrong");
}
} while (workerStatus != Finished);
您可以参考C#with Reliable Services中的wait on async call抛出意外超时异常和服务远程处理