【Azure 微服务】PowerShell中,用Connect-ServiceFabricCluster命令无法连接到sf-test.chinaeast2.cloudapp.chinacloudapi.cn:19000 问题分析
问题描述
Azure Service Fabric提供了PowerShell的指令来进行创建,管理资源,如Get-ServiceFabricClusterHealth 获取当前集群的健康状态,但这些命令都需要使用Connect-ServiceFabricCluster 先连接到集群。而在使用连接命令时候,始终连接不成功。本且是运行PowerShell命令的机器上已经安装了SF的主要证书。通过添加 -debug命令查看输出结果,不能连接成功的原因为认证失败。[System.Fabric.FabricServerAuthenticationFailedException: FABRIC_E_SERVER_AUTHENTICATION_FAILED: 0x800b0109]
解决办法
在Service Fabric证书页面中,发现有安装主要证书,和次要证书,当主要证书认证失败时,尝试通过次要证书连接SF集群。发现通过次要证书成功连接。
根据次要证书可以登录成功,主要证书确不可以的情况,进一步的调研和测试,得出Azure Service Fabrics SDK 的默认证书加载行为是部署和使用过期日期最远的已定义证书,而不管其主要或次要配置定义如何。以下的测试为两个证书到期时间一样,使用PowerShell连接的时候也是会选择次要证书进行连接。如果需要让Service Fabrics使用主要证书,则可以在创建证书的时候,让主要证书的过期时间长一些。
主次证书信息(注意:过期时间一样)
主要证书连接失败
次要证书连接成功
附录一: 错误消息
警告: Failed to contact Failover Manager Service, Attempting to contact FMM... False 详细信息: System.Fabric.FabricServerAuthenticationFailedException: FABRIC_E_SERVER_AUTHENTICATION_FAILED: 0x800b0109 ---> System.Runtime.InteropServices.COMException: 异常来自 HRESULT:0x80071C44 在 System.Fabri 1044 c.Interop.NativeClient.IFabricQueryClient11.EndGetPartitionList2(IFabricAsyncOperationContext context) 在 System.Fabric.FabricClient.QueryClient.GetPartitionListAsyncEndWrapper(IFabricAsyncOperationContext context) 在 System.Fabric.Interop.AsyncCallOutAdapter2`1.Finish(IFabricAsyncOperationContext context, Boolean expectedCompletedSynchronously) --- 内部异常堆栈跟踪的结尾 ---
附录二:Connect-ServiceFabricCluster完整命令
Connect-ServiceFabricCluster -ConnectionEndpoint 'sf-test.chinaeast2.cloudapp.chinacloudapi.cn:19000' ` >> -KeepAliveIntervalInSec 10 ` >> -X509Credential -ServerCertThumbprint 'your thumbprint' ` >> -FindType FindByThumbprint -FindValue 'your thumbprint' ` >> -StoreLocation CurrentUser -StoreName My -debug
参考资料
The Connect-ServiceFabricCluster cmdlet creates a connection to a Service Fabric cluster that allows you to run management actions for that cluster. After you connect to a cluster, you can view the settings of the connection by using the Get-ServiceFabricClusterConnection cmdlet.
To manage Service Fabric clusters, start Windows PowerShell by using the Run as administrator option.
- DVWA将密码设为空后仍然无法连接的问题:Could not connect to the MySQL service
- windows无法连接到user profile service服务。此问题阻止标准用户登录系统
- Windows无法连接到System Event Notification Service服务问题解决
- ORA-12514: TNS: 监听程序当前无法识别连接描述符中请求的服务 问题解决
- ORA-12514: TNS: 监听程序当前无法识别连接描述符中请求的服务 问题解决
- 使用java命令运行class文件提示“错误:找不到或无法加载主类“的问题分析
- ORA-12514: TNS: 监听程序当前无法识别连接描述符中请求的服务 问题解决
- 深入分析ORA-12514: TNS: 监听程序当前无法识别连接描述符中请求的服务
- 解决VS无法连接到已配置的开发web服务器或者部署在IIS上的web服务打不开的问题...
- 关于Java中使用hessian-3.0.20调用远程服务连接出错异常try catch无法捕捉的问题处理
- 解决ORA-12514:TNS:监听程序当前无法识别连接描述符中请求的服务的问题
- Android应用程序窗口(Activity)与WindowManagerService服务的连接过程分析
- 在微软报表服务中,使用odbc连接Sybase数据库,无法使用参数查询的问题我找到办法了
- win7 提示"Windows 无法连接到System Event Notification Service服务......"的解决办法
- Oracle几个基础配置问题:ORA-12154: TNS: 无法解析指定的连接标识符、ORA-12514: TNS: 监听程序当前无法识别连接描述符中请求的服务、ORA-12516 TNS监听程序找
- windows无法连接到group policy client服务.此问题阻止标准用户登陆系统.
- 使用java命令运行class文件提示“错误:找不到或无法加载主类“的问题分析
- ArcGIS API for javascript开发笔记(二)——解决ArcGIS Service中的服务在内网环境下无法进行javascript预览问题
- ORA-12514: TNS: 监听程序当前无法识别连接描述符中请求的服务 问题解决
- ORA-12514: TNS: 监听程序当前无法识别连接描述符中请求的服务 问题解决