繁体   English   中英

在DLL'WsmSvc.dll'中找不到名为'WSManInitialize'的入口点

[英]Unable to find an entry point named 'WSManInitialize' in DLL 'WsmSvc.dll'

我正在使用C#服务在远程计算机上执行Powershell命令并显示结果。 我正在使用C#库System.Management.Automation.Runspaces在远程系统上执行命令。

在其中一台服务器上,创建运行空间时发生TypeInitializationException,并且服务崩溃。

WSManConnectionInfo connectionInfo = new WSManConnectionInfo(new Uri("http://" + server + "/powershell"), strShellUri, cred);
connectionInfo.AuthenticationMechanism = AuthenticationMechanism.Kerberos;
runspace = RunspaceFactory.CreateRunspace(connectionInfo);

即使在try-catch块中捕获了异常之后,服务也崩溃了。 谷歌搜索时,异常是由内部异常触发的。

InnerException:System.EntryPointNotFoundException
Message =无法在DLL“ WsmSvc.dll”中找到名为“ WSManInitialize”的入口点。 StackTrace:位于System.Management.Automation.Remoting.Client.WSManClientSessionTransportManager上的System.Management.Automation.Remoting.Client.WSManNativeApi.WSManInitialize(Int32标志,IntPtr&wsManAPIHandle)。 位于System.Management.Automation.Remoting.Client.WSManClientSessionTransportManager ..cctor()的WSManAPIStaticData..ctor()

我该如何解决内部异常问题。

您尝试在其中运行代码的计算机上的WsmSvc.dll (或其依赖项之一)可能已过时(或版本不兼容)0。 唯一的解决方案是安装/更新该dll。 (假定错误消息是正确的。)

您可以尝试使用Dependency Walker来查看是否缺少任何依赖的dll或检查WsmSvc.dll导出函数。 在收到错误的服务器上运行它。

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM