HTTP Requests - VisualCron - Forum

Community forum

karembeu
2015-09-21T12:09:30Z
Every time I run an HTTP Request(under the NET category) I get this error:

Error at executing HTTP task: The underlying connection was closed: An unexpected error occurred on a send.

or

Error getting HTTP response: You must write ContentLength bytes to the request stream before calling [Begin]GetResponse.

Do not understand why. The link HTTP is working when I run it on a browser. Any suggestions?

Thanks in advance
Support
2015-09-21T13:18:25Z
Do you have a test url we could use for reproducing this?
Henrik
Support
http://www.visualcron.com 
Please like  VisualCron on facebook!
karembeu
2015-09-21T15:38:39Z
Unfortunately I do not have a test url. It was working before but has stopped recently
Support
2015-09-22T07:29:54Z
Could be some authentication that fails but it is hard to say if we cannot reproduce it.
Henrik
Support
http://www.visualcron.com 
Please like  VisualCron on facebook!
KJDavie
2015-09-23T20:53:39Z
Hi,

As Henrik noted could be authentication related.

We get this sort of error for High Security Sites using the HTTP Task:
--- snip ---
Exception in Task: System.Exception: Unhandled errors
Error getting HTTP response: The underlying connection was closed: An unexpected error occurred on a send.
--- snip ---

If you are trying a secure site, and your level of comfort, perhaps try a Powershell Task to Check.

Create a task and paste in the powershell below.

Basically this just ignores Certificate Errors to try to maximise the chances of it working.

Just replace "*** your website here ***" below with your site.

If you *know* the site is TLS 1.2 then you can uncomment the security protocol line below.
Otherwise if you aren't sure leave it commented out 😉.
---
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
# [System.Net.ServicePointManager]::SecurityProtocol = [Net.SecurityProtocolType]::Tls12
Invoke-WebRequest "https://*** your website here ***" -UseBasicParsing
---
2015-09-24_Powershell HTTPS Task Example.png
Scroll to Top