You need to enable JavaScript to run this app.
优惠活动
大模型
产品
解决方案
定价
更多

SSRS迁移报错:基础连接已关闭:接收时发生意外错误

SSRS迁移问题:RS.exe脚本中途连接断开+PowerShell订阅导入失败

一、RS.exe运行ssrs_migration.rss脚本中途报连接断开错误

针对The underlying connection was closed: An unexpected error occurred on a receive报错,可尝试以下方案:

  • 细粒度拆分迁移任务+添加请求间隔:修改rss脚本,将批量迁移拆分为单个资源(文件夹/报表/数据源)迁移,每次迁移完成后添加延迟,降低服务器请求压力。例如在迁移逻辑后插入:
    System.Threading.Thread.Sleep(2000) ' 延迟2秒
    
  • 生成RS.exe详细日志:启动RS.exe时添加日志参数,排查断开时的具体请求对象。命令示例:
    RS.exe -i ssrs_migration.rss -s http://source/ReportServer -t http://target/ReportServer -l migration_verbose.log
    
    查看日志定位是否为某特定资源(如超大报表、特殊数据源)导致连接中断。
  • 调整RS脚本中Web服务代理超时:在脚本创建ReportingService代理对象后,显式设置超时时间,覆盖默认值:
    Dim proxy As New ReportingService2010()
    proxy.Timeout = 3600000 ' 设置为1小时(单位毫秒)
    
  • 监控目标服务器资源状态:迁移期间查看目标SSRS服务器的CPU、内存、磁盘IO占用,若资源耗尽会主动断开连接,需暂停其他任务或升级服务器资源。
  • 单独迁移特殊资源:排查是否存在带大型嵌入式资源、超大数据集的报表,或使用非标准身份验证的数据源,单独迁移这类资源验证是否触发报错。

二、ReportingServiceTools PowerShell模块无法导入400+订阅并关联报表

针对订阅导入失败问题,按以下步骤排查修复:

  • 确保依赖资源完全匹配:订阅关联的报表、数据源、共享计划必须已迁移至目标服务器,且路径、名称完全一致(SSRS订阅通过资源ID关联,路径不匹配会导致关联失败)。
  • 修正订阅路径后导入:从源服务器导出订阅时保留路径信息,导入前修正为目标服务器的路径,示例脚本:
    # 从源服务器导出订阅
    Get-RsSubscription -ReportServerUri http://source/ReportServer -Path /Source/Reports | Export-Clixml -Path subscriptions.xml
    
    # 在目标服务器导入并修正路径
    $subscriptions = Import-Clixml subscriptions.xml
    foreach ($sub in $subscriptions) {
        # 将源路径替换为目标路径,示例:把"/Source/Reports"替换为"/Target/Reports"
        $sub.ReportPath = $sub.ReportPath -replace "^/Source/Reports", "/Target/Reports"
        Set-RsSubscription -ReportServerUri http://target/ReportServer -InputObject $sub
    }
    
  • 处理订阅身份验证与权限:若订阅使用Windows身份验证,确保目标SSRS的运行账户拥有对应权限;若订阅包含存储凭据,需重新配置凭据避免权限不足。
  • 批量导入添加重试机制:针对400+订阅的批量操作,添加异常捕获与重试逻辑,记录失败订阅单独处理:
    $failedSubs = @()
    $subscriptions = Import-Clixml subscriptions.xml
    foreach ($sub in $subscriptions) {
        try {
            $sub.ReportPath = $sub.ReportPath -replace "^/Source/Reports", "/Target/Reports"
            Set-RsSubscription -ReportServerUri http://target/ReportServer -InputObject $sub -ErrorAction Stop
            Write-Host "订阅 $($sub.SubscriptionID) 导入成功"
        }
        catch {
            Write-Host "订阅 $($sub.SubscriptionID) 导入失败: $_"
            $failedSubs += $sub
        }
    }
    # 导出失败订阅用于重试
    $failedSubs | Export-Clixml failed_subscriptions.xml
    
  • 检查订阅扩展兼容性:若订阅使用第三方扩展(如自定义邮件、打印扩展),目标服务器必须安装相同版本的扩展,否则会导致导入失败。

内容的提问来源于stack exchange,提问作者cisstudent123

相关产品推荐
方舟 Agent Plan

超全模态模型 × Harness 升级,最新支持 Deepseek-V4.1-Flash、GLM-5.3 系列、Doubao-Seedream-5.0-pro、Kimi-K3 (部分), 限时 9.9 元起

最近更新时间:2026.06.17 07:52:46