Ho un URL HTTPS che getta sotto eccezione:HTTPS URL utilizzando il WebDownloadClient genera un'eccezione
Exception Details: System.Exception: The underlying connection was closed: An unexpected error occurred on a send. ---> System.Net.WebException: The underlying connection was closed: An unexpected error occurred on a send. ---> System.IO.IOException: Received an unexpected EOF or 0 bytes from the transport stream.
Ho provato ad utilizzare la versione HTTP di URL e che sta lavorando. Ho anche controllato se gli URL https sono accessibili dalla macchina e sono accessibili senza errori, ma non rispondono al codice sottostante. Anche questo problema è specifico della macchina.
Linea di errore di lancio Codice:
using (WebDownloadClient wc = new WebDownloadClient())
{
wc.Headers.Add("Content-Encoding", "gzip");
wc.Headers.Add("Accept-Encoding", "gzip, compress");
wc.DownloadFile(url, fileName);
}
Che 'WebDownloadClient' è? Potresti fornire l'implementazione del metodo 'DownloadFile'? – Kamo
@Kamo DownloadFile è un metodo integrato di System.Net.WebClient – Pritam
Dai un'occhiata a questo http://stackoverflow.com/questions/20064505/requesting-html-over-https-with-c-sharp-webclient –