Stellen Sie Service Fabric über Powershell bereit. Fehler -> Get-ServiceFabricClusterManifest: Clusterverbindungsinstanz ist null

Ich versuche, die Service Fabric-Anwendung mit Powershell in Azure zu veröffentlichen. Ich möchte eine Verbindung zum Cluster herstellen und dann das Skript "Deploy-FabricApplication.ps1" aufrufen (eines, das generiert wird, wenn ein neues Projekt in Visual Studio erstellt wird).

Zu diesem Zweck habe ich eine neue Skriptdatei erstellt, die für die Verbindung mit dem Cluster verantwortlich ist, und dann aus derselben Skriptdatei "Deploy-FabricApplication.ps1" aufgerufen.

Nach dem Start meines Skripts erhalte ich folgende Fehlermeldung:

Get-ServiceFabricClusterManifest : Cluster connection instance is null
At C:\Program Files\Microsoft SDKs\Service Fabric\Tools\PSModule\ServiceFabricSDK\Publish-UpgradedServiceFabricApplication.ps1:116 char:28
+     $clusterManifestText = Get-ServiceFabricClusterManifest
+                            ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+ CategoryInfo          : ResourceUnavailable: (:) [Get-ServiceFabricClusterManifest], NullReferenceException
+ FullyQualifiedErrorId : GetClusterConnectionErrorId,Microsoft.ServiceFabric.Powershell.GetClusterManifest

In connection script und Deploy-FabricApplication.ps1 Ich rufe "Test-ServiceFabricClusterConnection" auf und in beiden Skripten wird True zurückgegeben. In beiden Skripten rufe ich "Get-ServiceFabricClusterManifest" auf und in beiden Fällen wird Manifest zurückgegeben, aber wenn hat "Test-ServiceFabricClusterConnection" zu "Publish-UpgradedServiceFabricApplication.ps1" hinzugefügt und dann denselben Fehler zurückgegeben, wie zuvor erwähnt, jedoch für den Aufruf "Test-ServiceFabricClusterConnection".

Code für das Verbindungsskript:

Param
(
    [String]
    $PublishProfileFile,

    [String]
    $ApplicationPackagePath,

    [Switch]
    $DeployOnly,

    [Boolean]
    $UnregisterUnusedApplicationVersionsAfterUpgrade,

    [String]
    [ValidateSet('None', 'ForceUpgrade', 'VetoUpgrade')]
    $OverrideUpgradeBehavior = 'None',

    [String]
    [ValidateSet('Never','Always','SameAppTypeAndVersion')]
    $OverwriteBehavior = 'Never',

    [Switch]
    $SkipPackageValidation,

    [String]
    $ConnectionEndpoint,

    [String]
    $ServerCertThumbprint,

    [String]
    $FindType,

    [String]
    $FindValue,

    [String]
    $StoreLocation,

    [String]
    $StoreName
)

$connectArgs = @{ ConnectionEndpoint = $ConnectionEndpoint;  X509Credential = $True;  StoreLocation = $StoreLocation;  StoreName = $StoreName;  ServerCertThumbprint = $ServerCertThumbprint; FindType = $FindType;  FindValue = $FindValue }

try
{
    Connect-ServiceFabricCluster @connectArgs;
    $connection = Get-ServiceFabricClusterConnection;
    Write-Host $connection;
    $m = Get-ServiceFabricClusterManifest
    Write-Host $m;
}
catch [System.Fabric.FabricObjectClosedException]
{
    Write-Warning "Service Fabric cluster may not be connected."
    throw
}

.\Deploy-FabricApplication.ps1 -PublishProfileFile $PublishProfileFile -ApplicationPackagePath $ApplicationPackagePath -OverrideUpgradeBehavior $OverrideUpgradeBehavior -OverwriteBehavior $OverwriteBehavior -DeployOnly:$DeployOnly -UnregisterUnusedApplicationVersionsAfterUpgrade:$UnregisterUnusedApplicationVersionsAfterUpgrade -UseExistingClusterConnection:$true -SkipPackageValidation:$SkipPackageValidation

Um zusammenzufassen, ich habe keine Ahnung, wie eine Verbindung zum Cluster hergestellt und dann in Deploy-FabricApplication.ps1 verwendet werden soll.

Danke für die Hilf

Antworten auf die Frage(2)

Ihre Antwort auf die Frage