Alexandru Alexandru - 1 month ago 20
C# Question

How can I use PowerShell to install this service fabric project?

I have the following folder structure once I package my Service Fabric

NS1.NS2.MicroServicesTest
project (written in
C#
, using
.NET
):

pkg
|-NS1.NS2.MicroServicesTest.MicroServiceA
|-NS1.NS2.MicroServicesTest.MicroServiceB
|-NS1.NS2.MicroServicesTest.MicroServiceC
|-NS1.NS2.MicroServicesTest.MicroServiceD
|-ApplicationManifest.xml


I am trying to deploy this package using the following
PowerShell
script:

Copy-ServiceFabricApplicationPackage pkg -ImageStoreConnectionString file:C:\SfDevCluster\Data\ImageStoreShare -ApplicationPackagePathInImageStore NS1.NS2.MicroServicesTest
Register-ServiceFabricApplicationType NS1.NS2.MicroServicesTest
New-ServiceFabricApplication fabric:/NS1.NS2.MicroServicesTest NS1.NS2.MicroServicesTest 1.0.0


It fails on the last command,
New-ServiceFabricApplication
, with the following error:


New-ServiceFabricApplication : Application type and version not found


Where have I gone wrong? I have tried to follow this tutorial, albeit it kind of uses a base case in its example, whereas my project has 4 microservices as part of it, and an odd naming convention, which makes it even more confusing...

Edit: When I run the
Get-ServiceFabricApplicationType
command, I see:

ApplicationTypeName : MicroServicesTestType
ApplicationTypeVersion : 1.0.0
DefaultParameters : { "MicroServiceA_InstanceCount" = "-1";
"MicroServiceB_InstanceCount" = "-1";
"MicroServiceC_Endpoint" = "defaultValue";
"MicroServiceC_InstanceCount" = "-1";
"MicroServiceC_MaxRecords" = "100";
"MicroServiceD_InstanceCount" = "-1" }

Answer

(from discussion to answer)

  • After registering it, validate that your Application Type shows up when calling 'Get-ServiceFabricApplicationType'

  • Check your Application Type version 1.0.0?

  • Try using this command: New-ServiceFabricApplication fabric:/ MicroServicesTestType MicroServicesTestType 1.0.0