要在我们的Windows Fabric独立群集上部署应用程序,我们使用Service Fabric API。 目前我们遇到了重新部署的问题。一个新的新部署是可以的。当应用程序已存在时,我们首先将其删除,但新应用程序未达到健康状态。
关于它可能是什么/什么是错误的任何建议?在删除和部署之间是否需要一些超时?
// Clean up previous deployment.
var application = (await fabricClient.QueryManager.GetApplicationListAsync(applicationUri).ConfigureAwait(false)).SingleOrDefault();
if(application != null)
{
// Removing application instance...
await fabricClient.ApplicationManager.DeleteApplicationAsync(new DeleteApplicationDescription(applicationName)
{
ForceDelete = true
}).ConfigureAwait(false);
}
var applicationType = (await fabricClient.QueryManager.GetApplicationTypeListAsync(applicationTypeName).ConfigureAwait(false)).SingleOrDefault();
if(applicationType != null)
{
// Unregistering application type...
await fabricClient.ApplicationManager.UnprovisionApplicationAsync(applicationTypeName, applicationTypeVersion).ConfigureAwait(false);
}
// Create the new deployment
// Copying application package...
fabricClient.ApplicationManager.CopyApplicationPackage(imageStoreConnectionString, applicationPackageDirectoryPath, applicationTypeName);
// Registering application type...
await fabricClient.ApplicationManager.ProvisionApplicationAsync(applicationTypeName).ConfigureAwait(false);
// Creating application...
await fabricClient.ApplicationManager.CreateApplicationAsync(new ApplicationDescription(applicationUri, applicationTypeName, applicationTypeVersion)).ConfigureAwait(false);