使用Powershell在SSRS 2008中上载多个报告RDL时出错

使用Powershell在SSRS 2008中上载多个报告RDL时出错,powershell,reporting-services,ssrs-2008,out-of-memory,Powershell,Reporting Services,Ssrs 2008,Out Of Memory,我有Windows 2008 Server 64位、Sql Server Reporting Services 2008 R2。 我使用ReportServiceWeb服务上载RDLs文件。我使用脚本ps1 Powershell上载报告,如: 我上传报告时出错。前5个RDL上传正确,但下一个错误。 REP\u ACCESO\u AIRNET04\u R\u 09、REP\u ACCESO\u AIRNET04\u R\u 10、REP\u ACCESO\u AIRNET04\u R\u 11、

我有Windows 2008 Server 64位、Sql Server Reporting Services 2008 R2。 我使用ReportServiceWeb服务上载RDLs文件。我使用脚本ps1 Powershell上载报告,如:

我上传报告时出错。前5个RDL上传正确,但下一个错误。 REP\u ACCESO\u AIRNET04\u R\u 09、REP\u ACCESO\u AIRNET04\u R\u 10、REP\u ACCESO\u AIRNET04\u R\u 11
REP\u ACCESO\u AIRNET04\u R\u 12
正确上传

REP_ACCESO_AIRNET04_R_13
没有,那么我得到了错误

如果使用3-4个报告rdl,没有问题。但是使用更多的rdls文件,我会出错

我检查了SQL Server Reporting Services,它正在运行

我在powershell中遇到了几个错误,它使用我的脚本ps1在SSRS中安装-上载报告RDL:

Exception of type 'System.OutOfMemoryException' was thrown.

Failed. The error was: 'Error al procesar los datos de un comando remoto. Mensa
je de error: <f:WSManFault xmlns:f="http://schemas.microsoft.com/wbem/wsman/1/w
smanfault" Code="3762507597" Machine="DESCASRPSW01"><f:Message><f:ProviderFault
 provider="microsoft.powershell" path="C:\Windows\system32\pwrshplugin.dll"></f
:ProviderFault></f:Message></f:WSManFault> Para obtener m s informaci¢n, consul
te el tema de la Ayuda about_Remote_Troubleshooting.'.


Failed. The error was: 'Error al procesar los datos de un comando remoto. Mensa
je de error: The WSMan provider host process did not return a proper response. 
 A provider in the host process may have behaved improperly. Para obtener m s i
nformaci¢n, consulte el tema de la Ayuda about_Remote_Troubleshooting.'.
解决方案:使用[System.IO.File]::ReadAllBytes($sourceFile)

参考资料:

在加载二进制文件时,获取内容非常占用内存且效率低下。每个字节都被包装到psObject中。我建议使用.Net函数(.Net v4有File.ReadAllBytes方法)–@user1578107

“我自己也遇到过类似的问题,RAM使用率影响了GB上传3MB文件,我发现:

与:


这不是由重命名文件或文件夹引起的


主要问题是您的脚本导致了
System.OutOfMemoryException


尝试以小批量上载报告或在尝试上载之间插入等待。

使用[System.IO.File]::ReadAllBytes($sourceFile)

参考资料:

获取内容在加载二进制文件时非常占用内存且效率低下 文件每个字节都被包装到psObject中。我建议使用.Net 函数(.Net v4有File.ReadAllBytes方法)–@user1578107

“我自己也遇到过类似的问题,RAM使用率影响了GB上传3MB文件,我发现:

与:


似乎有人或某事正在更改属于Reporting Services服务的文件/文件夹。问题是使用PSRemoting和Get Content获取RDL文件的Get字节。没有PSRemoting的相同脚本ps1是正确的。
Get Content
在加载二进制文件时非常占用内存且效率低下。每个字节都被包装到
PSObject
中。我建议使用.Net函数(.Net v4有
File.ReadAllBytes
method)
System.OutOfMemoryException
来自powershell远程处理,而不是reporting services。问题是使用PSRemoting和获取RDL文件的Get字节的内容。没有PSRemoting的相同脚本ps1是正确的。
#Load the RDL Binary 
[Byte[]]$rptContent = Get-Content $rptReference -Encoding byte
 $content = gc -en byte $sourceFile
 $content = [System.IO.File]::ReadAllBytes($sourceFile)
 $content = gc -en byte $sourceFile
 $content = [System.IO.File]::ReadAllBytes($sourceFile)