Recently (Service Fabric SDK v 2.4.145) I had deployed a Service Fabric application to my local cluster from Visual Studio. As part of an upgrade process after I changed something in the Settings.xml file for my service, I was executing the following PowerShell code:
Copy-ServiceFabricApplicationPackage -ApplicationPackagePath '.' `
-ImageStoreConnectionString 'file:C:\SfDevCluster\Data\ImageStoreShare' -ApplicationPackagePathInImageStore 'SFConfigModified'
Register-ServiceFabricApplicationType -ApplicationPathInImageStore 'SFConfigModified' -TimeoutSec 300
-ApplicationName 'fabric:/SFConfigModified' `
-ApplicationTypeVersion '1.0.17' `
This is when I received the following error in the PowerShell command window:
Registering application type…
Register application type succeeded
Start-ServiceFabricApplicationUpgrade : Default service descriptions must not be modified as
part of upgrade. Modified default service: fabric:/SFConfigModified/StatelessWebApi
At C:\Workshops\AzureSF\HelperFiles\testconfigchanged.ps1:13 char:1
+ Start-ServiceFabricApplicationUpgrade `
+ CategoryInfo : InvalidOperation: (Microsoft.Servi...usterConnection:ClusterConne
ction) [Start-ServiceFabricApplicationUpgrade], FabricException
+ FullyQualifiedErrorId : UpgradeApplicationErrorId,Microsoft.ServiceFabric.Powershell.Star
For some reason, the upgrade thinks I have modified my ApplicationManifest.xml file in the <DefaultServices> section, although I know I did not modify it.
I have discovered that this issue is something that will be corrected in the near future, but how do you get this working again to be able to do updates from PowerShell?
Here is what I had to do to get things working again:
- Open Service Fabric Explorer and remove the application from the cluster.
- In my PS script, after the Register-ServiceFabricApplicationType command, execute the command to do a new deployment:
New-ServiceFabricApplication -ApplicationName 'fabric:/SFConfigModified' -ApplicationTypeName 'SFConfigModifiedType' -ApplicationTypeVersion 1.0.15
- Comment out the New-ServiceFabricApplication line of code.
From this point on, I could do upgrades to my application.