如何使用PowerShell安装此服务结构项目?

时间:2016-10-13 19:29:21

标签: c# .net powershell azure azure-service-fabric

我打包Service Fabric NS1.NS2.MicroServicesTest项目(使用C#编写.NET后)后,我有以下文件夹结构:

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

我正在尝试使用以下PowerShell脚本部署此程序包:

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

在最后一个命令New-ServiceFabricApplication上失败,出现以下错误:

  

New-ServiceFabricApplication:未找到应用程序类型和版本

我哪里出错了?我试图遵循这个tutorial,虽然它在它的例子中使用了一个基本情况,而我的项目有4个微服务作为它的一部分,以及一个奇怪的命名约定,这使它更令人困惑......

编辑:当我运行Get-ServiceFabricApplicationType命令时,我看到:

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" }

1 个答案:

答案 0 :(得分:2)

(从讨论到回答)

  • 注册后,请在调用' Get-ServiceFabricApplicationType'

  • 时验证您的应用类型是否显示
  • 检查您的应用程序类型版本1.0.0?

  • 尝试使用此命令:New-ServiceFabricApplication fabric:/ MicroServicesTestType MicroServicesTestType 1.0.0