powershell - Invoke-WebRequest fails for a large file -
following issue: using power shell script below works transferring .war file server server b via tomcat manager when size of war file below 4mb. above size fails with
invoke-webrequest : underlying connection closed: unexpected error occurred on send. @ c:\temp\deploy.ps1:25 char:2 + (invoke-webrequest -infile "c:\temp\fancy.war" -uri "https: ... + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + categoryinfo : invalidoperation: (system.net.httpwebrequest:httpwebrequest) [invoke-webrequest], webexception + fullyqualifiederrorid : webcmdletwebresponseexception,microsoft.powershell.commands.invokewebrequestcommand
code run via powershell on server is:
set-psdebug -trace 1 $allprotocols = [system.net.securityprotocoltype]'ssl3,tls,tls11,tls12' [system.net.servicepointmanager]::securityprotocol = $allprotocols add-type @" using system.net; using system.security.cryptography.x509certificates; public class trustallcertspolicy : icertificatepolicy { public bool checkvalidationresult( servicepoint srvpoint, x509certificate certificate, webrequest request, int certificateproblem) { return true; } } "@ [system.net.servicepointmanager]::certificatepolicy = new-object trustallcertspolicy $user = "admin" $pass = "loveit" $secpass = convertto-securestring $pass -asplaintext -force $credential = new-object system.management.automation.pscredential($user, $secpass) (invoke-webrequest -infile "c:\temp\fancy.war" -uri "**https**://host99.some.domain:443/manager/text/deploy?path=/fancy&update=true" -method put -credential $credential -contenttype 'application/zip' -usebasicparsing -timeoutsec 120)
i played around server.xml of tomcat8 , web.xml of tomcat manager mentioned in post how deploy war file in tomcat 7
as seen, 50 mb on safe side.
\webapps\manager\web-inf\web.xml
<multipart-config> <!-- 50mb max --> <max-file-size>52428800</max-file-size> <max-request-size>52428800</max-request-size> <file-size-threshold>0</file-size-threshold> </multipart-config>
server.xml
<connector port="443" maxpostsize="67589953" protocol="org.apache.coyote.http11.http11nioprotocol" sslenabled="true" maxthreads="150" scheme="https" secure="true" clientauth="false" sslprotocol="tls" sslenabledprotocols="tlsv1,tlsv1.1,tlsv1.2" useserverciphersuitesorder="true" ciphers="tls_ecdhe_rsa_with_aes_256_cbc_sha384,tls_dhe_rsa_with_aes_256_cbc_sha256,tls_ecdhe_rsa_with_aes_128_cbc_sha256,tls_dhe_rsa_with_aes_128_cbc_sha256,tls_ecdhe_rsa_with_aes_256_gcm_sha384,tls_dhe_rsa_with_aes_256_gcm_sha384,tls_ecdhe_rsa_with_aes_128_gcm_sha256,tls_dhe_rsa_with_aes_128_gcm_sha256" server="web server" minsparethreads="25" allowtrace="true" keystorefile="cert.pfx" keystorepass="" keystoretype="pkcs12" connectiontimeout="100000000" />
thanks help!
wiki
Comments
Post a Comment