When running Connect-ExchangeOnline I am getting "Could not load file or assembly 'System.Net.Http, Version=4.2.0.0" error

huangapple go评论60阅读模式
英文:

When running Connect-ExchangeOnline I am getting "Could not load file or assembly 'System.Net.Http, Version=4.2.0.0" error

问题

我刚刚在安装了.NET 4.0并具有两个版本的PowerShell(5.1和7)的服务器上成功安装了ExchangeOnlineManagement PowerShell模块。我可以导入该模块,但当我尝试连接"Connect-ExchangeOnline"时,出现错误:

无法加载文件或程序集'System.Net.Http, Version=4.2.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a'或其依赖项之一。系统找不到指定的文件。
在C:\Program Files\WindowsPowerShell\Modules\ExchangeOnlineManagement\3.1.0\netFramework\ExchangeOnlineManagement.psm1:729字符:21

  •                 throw $_.Exception.InnerException;
    
  •                 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    
    • CategoryInfo : OperationStopped: (:) [], FileNotFoundException
    • FullyQualifiedErrorId : 无法加载文件或程序集'System.Net.Http, Version=4.2.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a'或其依赖项之一。系统找不到指定的文件。
英文:

I just successfully installed ExchangeOnlineManagement PowerShell module on a server that has .Net 4.0 installed and two versions of PowerShell (5.1 and 7). I am able to import the module but when I try to connect "Connect-ExchangeOnline" I get an error:

Could not load file or assembly 'System.Net.Http, Version=4.2.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a' or one of its dependencies. The system
cannot find the file specified.
At C:\Program Files\WindowsPowerShell\Modules\ExchangeOnlineManagement\3.1.0\netFramework\ExchangeOnlineManagement.psm1:729 char:21

  •                 throw $_.Exception.InnerException;
    
  •                 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    
    • CategoryInfo : OperationStopped: (:) [], FileNotFoundException
    • FullyQualifiedErrorId : Could not load file or assembly 'System.Net.Http, Version=4.2.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a' or one of
      its dependencies. The system cannot find the file specified.

答案1

得分: 1

考虑查看你正在使用的.NET Framework版本。我无法在.NET Framework 4.6.2上运行ExchangeOnlineManagement PowerShell模块3.1.0,但可以在.NET Framework 4.8上运行。(参考:https://funwithiagengineering.blogspot.com/2023/06/issue-migrating-to-exchangeonlinemanage.html)

英文:

Consider looking into the version of .NET Framework you are running. I could not run ExchangeOnlineManagement PowerShell module 3.1.0 on .NET Framework 4.6.2, but I could on .NET Framework 4.8. (ref. https://funwithiagengineering.blogspot.com/2023/06/issue-migrating-to-exchangeonlinemanage.html)

huangapple
  • 本文由 发表于 2023年2月24日 07:00:22
  • 转载请务必保留本文链接:https://go.coder-hub.com/75551176.html
匿名

发表评论

匿名网友

:?: :razz: :sad: :evil: :!: :smile: :oops: :grin: :eek: :shock: :???: :cool: :lol: :mad: :twisted: :roll: :wink: :idea: :arrow: :neutral: :cry: :mrgreen:

确定