我在 SSRS 2019 上运行第一份报告时遇到问题,需要 20 到 30 秒才能呈现。
我知道这是 SSRS 众所周知的行为,所以我尝试以这种方式进行管理:
Stop-Service "SQLServerReportingServices"
Start-Service "SQLServerReportingServices"
Start-Sleep -Seconds 20
$webclient = New-Object system.net.webClient
$webclient.Credentials = New-Object system.net.NetworkCredential("user", "password", "")
$webpage = $webclient.DownloadString("http://localhost/Reports/Pages/Folder.aspx")
虽然脚本很好,但我仍然对第一次渲染有问题,需要时间才能显示。
有什么解决办法吗?
在网上深入搜索后,我找到了解决服务重启时加载缓慢问题的方法。 我已经修改了指向 ReportServer 页面而不是 Reports 的下载字符串:
Stop-Service "SQLServerReportingServices"
Start-Service "SQLServerReportingServices"
Start-Sleep -Seconds 20
$webclient = New-Object system.net.webClient
$webclient.Credentials = New-Object system.net.NetworkCredential("user", "password", "domain")
$webpage = $webclient.DownloadString("http://localhost/ReportServer")
PowerShell脚本运行流畅,报表渲染仅需5秒。