如题,下面是代码和错误信息:
代码:
string server = Convert.ToString(ConfigurationManager.AppSettings["serverName"]);
string username = Convert.ToString(ConfigurationManager.AppSettings["userName"]);
string str_password = Convert.ToString(ConfigurationManager.AppSettings["userPassword"]);
string uri = "https://" + server + "/OcsPowerShell";
string shellUri = "http://schemas.microsoft.com/powershell/Microsoft.Powershell";
SecureString secPwd = new SecureString();
foreach (char c in str_password.ToCharArray())
{
secPwd.AppendChar(c);
}
RunspaceConfiguration config = RunspaceConfiguration.Create();
WSManConnectionInfo connInfo = new WSManConnectionInfo(new Uri(uri), shellUri, new PSCredential(username, secPwd));
Runspace runspace = RunspaceFactory.CreateRunspace(connInfo);
try
{
runspace.Open();
}
catch (Exception ex)
{
//SystemLog.Error("",ex.ToString());
}
finally
{
runspace.Dispose();
}
错误信息:
Error: time:15:37:14 --- 创建远程Runspace时报错--- 错误信息:System.Management.Automation.Remoting.PSRemotingTransportException: 连接到远程服务器 lyncserver.contoso.com 失败,并显示以下错误消息: 目标计算机(lyncserver.contoso.com:443)上的服务器证书包含以下错误:
无法检查 SSL 证书吊销。用于检查吊销的服务器可能不可访问。 有关详细信息,请参阅 about_Remote_Troubleshooting 帮助主题。
在 System.Management.Automation.Runspaces.AsyncResult.EndInvoke()
在 System.Management.Automation.Runspaces.Internal.RunspacePoolInternal.EndOpen(IAsyncResult asyncResult)
在 System.Management.Automation.Runspaces.Internal.RemoteRunspacePoolInternal.Open()
在 System.Management.Automation.RemoteRunspace.Open()
在 IWS.ADM.Framework.DataProviders.LyncDAL.InitRunspace()
哪位大神遇见过此问题,还请告诉怎么解决,谢谢。