C# WinRM客户端在WinRM中打开运行空间时向HTTP服务器发送了请求

C# WinRM客户端在WinRM中打开运行空间时向HTTP服务器发送了请求,c#,powershell,winrm,C#,Powershell,Winrm,我正在尝试使用powershellsystem.Management.Automationdll访问远程系统服务详细信息 当我执行以下代码连接到远程系统时,我遇到了错误: 代码段: string shellUri = "http://schemas.microsoft.com/powershell/Microsoft.PowerShell"; PSCredential remoteCredential = new PSCredential("uname", this.convertToSecur

我正在尝试使用powershell
system.Management.Automation
dll访问远程系统服务详细信息

当我执行以下代码连接到远程系统时,我遇到了错误:

代码段:

string shellUri = "http://schemas.microsoft.com/powershell/Microsoft.PowerShell";
PSCredential remoteCredential = new PSCredential("uname", this.convertToSecureString("password"));
WSManConnectionInfo connectionInfo = new WSManConnectionInfo(new Uri("http://machinename/powershell"), shellUri, remoteCredential);
connectionInfo.AuthenticationMechanism = AuthenticationMechanism.Kerberos;
Runspace runspace = RunspaceFactory.CreateRunspace(connectionInfo);
runspace.Open();//Here Exception raised
错误详细信息:

WinRM客户端向HTTP服务器发送请求并获得响应 表示请求的HTTP URL不可用。这通常是 由不支持WS-Management的HTTP服务器返回 协议


我也有同样的问题,我使用和使用的uri是/
对于基本身份验证,我也有类似的错误消息,因此在某些情况下需要使用Kerberos

uri。。如果我没有弄错的话,应该是
http://machineName:5985/wsman
。它确实取决于WSMan服务在远程计算机上的托管方式。。除非您知道必须使用您已经使用的uri访问它,否则我建议您在此评论中尝试使用uri。我最近碰巧在Windows server 2012 R2上配置了Exchange server 2013,除“Exchange命令行管理程序”外,所有配置均能正常工作。这就是我所遵循的。。。