【问题标题】:Publish to Service Fabric Cluster fails because of Test-ServiceFabricClusterConnection由于 Test-ServiceFabricClusterConnection,发布到 Service Fabric 群集失败
【发布时间】:2017-01-30 05:18:04
【问题描述】:

我正在使用您创建 Service Fabric 项目时生成的 Deploy-FabricApplication.ps1 脚本来部署我的应用程序。

部署到 Service Fabric 群集时,如果我首先使用 Connect-ServiceFabricCluster 连接到本地群集,则可以在本地部署。但是,我的构建服务器没有运行本地集群实例,因此我无法首先连接到本地实例。当我与Connect-ServiceFabricCluster @ClusterConnectionParameters 连接时,我会在连接成功时获得数据。当它到达发布并运行 Test-ServiceFabricClusterConnection 命令时,我收到以下错误。

WARNING: Unable to Verify connection to Service Fabric cluster.
Test-ServiceFabricClusterConnection : Cluster connection instance is null
At C:\ProgramFiles\MicrosoftSDKs\ServiceFabric\Tools\PSModule\ServiceFabricSDK\Publish-NewServiceFabricApplication.ps1:129 char:16
+         [void](Test-ServiceFabricClusterConnection)
+                ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    + CategoryInfo          : ResourceUnavailable: (:) [Test-ServiceFabricClusterConnection], NullReferenceException
    + FullyQualifiedErrorId : GetClusterConnectionErrorId,Microsoft.ServiceFabric.Powershell.TestClusterConnection

我尝试从 Publish-NewServiceFabricApplication.ps1 模块中删除 Test-ServiceFabricClusterConnection,但我得到了一组不同的错误。到目前为止,无论我尝试了什么,如果我首先连接到集群,它就可以工作,但如果我通过 powershell 脚本连接,则不会。

更新!解决了 使用点源解决了这个问题:How do I deploy service fabric application from VSTS release pipeline?

【问题讨论】:

  • 你的标题是Test-ServiceFabricClusterConnection,但你的错误信息是Get-ServiceFabricApplication,那是哪个? $ApplicationName 是如何填充的? @ClusterConnectionParameters 是如何填充的?你在哪里打电话给Connect-ServerFabricCluster
  • 如果您在开发机器上使用相同的参数设置调用“Connect-ServiceFabricCluster @ClusterConnectionParameters”会发生什么?
  • @AnsgarWiechers 我修改了我的问题
  • 更新!用点源解决了它stackoverflow.com/questions/35711540/…
  • @KenWin0x539 你不能用正确的答案而不是 cmets 来回答你自己的问题吗? :-) 我也有类似的问题,运行 Connect-ServerFabricCluster 似乎可以解决它(我正在部署到本地 SF 集群)

标签: powershell azure-service-fabric


【解决方案1】:

在调用Connect-ServiceFabricCluster 后设置$global:clusterConnection = $clusterConnection 或使用dot source notation 调用Deploy-FabricApplication.ps1

Connect-ServiceFabricCluster 的调用在本地Powershell 作用域上设置了一个$clusterConnection 变量,在调用其他作用域时该变量会丢失。请参阅this post 了解更多信息。

【讨论】:

    【解决方案2】:

    请检查您的机器上是否正确安装了证书。我遇到了类似的问题并安装了证书并且它有效。还要验证商店位置是否正确设置为

    StoreLocation="LocalMachine"

    如果您在本地机器上安装了证书,则将其设置为 StoreLocation="CurrentUser"

    【讨论】:

      【解决方案3】:

      对我来说,它从 $clusterConnection = Connect-ServiceFabricCluster -ConnectionEndpoint $ClusterConnectionParameters.ConnectionEndpoint -ErrorAction Stop

      Connect-ServiceFabricCluster -ConnectionEndpoint $ClusterConnectionParameters.ConnectionEndpoint -ErrorAction Stop

      【讨论】:

        猜你喜欢
        • 2018-11-14
        • 2017-08-06
        • 2019-03-15
        • 2017-04-07
        • 2019-02-04
        • 2021-04-18
        • 2016-11-01
        • 2017-02-25
        • 2016-03-25
        相关资源
        最近更新 更多