【问题标题】:Error connecting to Sharepoint site from Powershell从 Powershell 连接到 Sharepoint 站点时出错
【发布时间】:2021-05-21 00:06:54
【问题描述】:

几天前,当我尝试连接到 Sharepoint 站点时,我开始收到以下错误。

System.Net.WebException:底层连接已关闭:发送时发生意外错误。 ---> System.IO.IOException: Unable to read data from the transport connection: 一个现有的连接被远程主机强行关闭。 ---> System.Net.Sockets.SocketException: 现有连接被远程主机强行关闭

根据下面的文档,我尝试在下面进行注册表更改并在 Powershell 命令下运行,重新启动服务器但仍然收到相同的错误。最近有什么变化吗?

https://docs.microsoft.com/en-us/sharepoint/troubleshoot/administration/authentication-errors-tls12-support

https://docs.microsoft.com/en-us/mem/configmgr/core/plan-design/security/enable-tls-1-2-client#configure-for-strong-cryptography

[HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\.NETFramework\v2.0.50727]
      "SystemDefaultTlsVersions" = dword:00000001
      "SchUseStrongCrypto" = dword:00000001
[HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\.NETFramework\v4.0.30319]
      "SystemDefaultTlsVersions" = dword:00000001
      "SchUseStrongCrypto" = dword:00000001

Enable-TlsCipherSuite -Name "TLS_DHE_DSS_WITH_AES_256_CBC_SHA"

【问题讨论】:

    标签: powershell sharepoint sharepoint-online


    【解决方案1】:

    在连接到 SharePoint 站点之前尝试添加以下代码行:

    PowerShell

    [System.Net.ServicePointManager]::SecurityProtocol = [System.Net.SecurityProtocolType]::Tls12;

    .NET

    ServicePointManager.SecurityProtocol = SecurityProtocolType.Tls12;

    这应该适合你。

    更新: 添加了 PowerShell 等效代码。

    【讨论】:

    • 我的是powershell脚本。正确的语法应该是什么?
    • 试过 [Net.ServicePointManager]::SecurityProtocol = [Net.SecurityProtocolType]::Tls12 但同样的错误
    • 看看你是否在脚本的顶部添加,并且在运行后你还没有关闭会话,如文章中所述:sharepointviews.com/the-underlying-connection-was-closed
    • 根据 docs.microsoft.com/en-us/mem/configmgr/core/plan-design/… ,NET Framework 4.6.2 及更高版本支持 TLS 1.1 和 TLS 1.2。我已经安装了 4.7。那么为什么我需要再次添加这一行呢?
    • 想知道为什么它到现在还有效,而不是从一周左右开始。
    猜你喜欢
    • 2022-11-24
    • 1970-01-01
    • 2017-12-23
    • 2017-08-25
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2023-03-03
    • 1970-01-01
    相关资源
    最近更新 更多