【发布时间】:2018-07-19 23:26:02
【问题描述】:
我已经部署了一个安全的 Service Fabric 集群,并且能够使用证书通过浏览器和 Powershell 进行连接。当从 C# 中尝试相同的错误时:
执行过程中发生错误
在 System.Fabric.Interop.Utility.WrapNativeSyncInvoke[TResult](Func`1 func, 字符串 functionTag, 字符串 functionArgs) 在 System.Fabric.Interop.Utility.RunInMTA(动作动作)在 System.Fabric.FabricClient.InitializeFabricClient(SecurityCredentials credentialArg,FabricClientSettings 新设置,字符串 [] hostEndpointsArg) 在 CloseAppAPI.Controllers.CloseClientController.d__0.MoveNext() 在 C:\Users\kumar.kshitij\source\repos\CloseAPP\CloseAppAPI\Controllers\CloseClientController.cs:line 39 英寸。
附上图片和代码供参考。如果您有解决方案,请任何人告诉我。
C#代码如下:-
string CommonName = "www.cluster1.eastus2.cloudapp.azure.com";
string connection = "cluster1.eastus2.cloudapp.azure.com:19000";
var xc = GetCredentials(CommonName);
var fc = new FabricClient(xc, connection);
static X509Credentials GetCredentials(string clientCertThumb,
string serverCertThumb, string name)
{
X509Credentials xc = new X509Credentials();
xc.StoreLocation = StoreLocation.LocalMachine;
xc.StoreName = "Personal";
xc.FindType = X509FindType.FindByThumbprint;
xc.FindValue = "08DF81BD17507D4ADEC4DEE075E33A3CB8C8D04E";
xc.RemoteCommonNames.Add(name);
xc.RemoteCertThumbprints.Add("3D317C232F06AC1F5A2C8D16CC2830D6F7CD5FAC");
//xc.ProtectionLevel = ProtectionLevel.EncryptAndSign;
return xc;
}
【问题讨论】:
标签: c# powershell azure-service-fabric