Powershell Invoke-WebRequest:请求标头太大

时间:2019-02-28 04:08:05

标签: powershell exception invalid-argument

我有以下Powershell代码可从服务器下载文件:

$url1 = "https://exampleofaveryverylongurl_getreport_1"
$file1 = "C:\User\test.csv"
$parameter1 = $url1, $info, $file1

$url2 = "https://exampleofaveryverylongurl_getreport_2"
$file2 = "C:\User\test.csv"
$parameter2 = $url2, $info, $file2

$request_Arr = $parameter1, $parameter2

foreach ($item in $request_Arr) {Invoke-WebRequest -uri $item[0] -Credential $item[1] -TimeOutSec 600 -UseBasicParsing -OutFile $item[2]}

但是,我遇到以下异常:

HTTP Status 400 - Bad RequestType Exception 
ReportMessage Request header is too largeDescription      
The server cannot or will not process the request due to 
something that is perceived to be a client error 
(e.g., malformed request syntax, invalid request 
message framing, or deceptive request routing).Exceptionjava.lang.IllegalArgumentException: 
Request header is too large

想知道是否有办法解决它吗?

0 个答案:

没有答案