Oppure

Loading
21/04/10 10:58
marco444
ciao a tutti,
sto provando a fare l'upload di un file exe in un ftp con questo codice:


Private WithEvents up As New System.Net.WebClient


up.Credentials = New System.Net.NetworkCredential("", "";)
Dim address As Uri = New Uri("";)

up.UploadFile(address, ("C:\";))


in win 7 funziona perfettamente, anche con vista, ma con xp mi da questo errore:

allfreeportal.com/imghost2/images/…


perchè secondo voi?

Ultima modifica effettuata da marco444 21/04/10 14:24
aaa
21/04/10 12:18
marco444
mi correggo, il problema si verifica solo con il .net 2.0
aaa
21/04/10 15:40
NetProgrammer
Dallo screen dell'errore si capisce che c'è una violazione di protocollo, inoltre il codice che hai postato è incompleto e contenenti errori,infatti se non mi sbaglio non vedo alcun pezzo di codice che tenta di gestire una connessione ftp efficiente!!
Comunque da quello che ho capito l'errore risiede in address,in quanto non viene specificato nessun dominio ftp.
Comunque se analizzi l'errore nel testo dell'errore ti dovrebbe dire anche la riga che l'ha generato.
Ultima modifica effettuata da NetProgrammer 21/04/10 15:41
aaa
21/04/10 16:26
marco444
ma perchè il codice che uso va bene in qualunque versione del .net, tranne che nella 2.0
aaa
21/04/10 16:44
Il Totem
Spiegazione:
Essentially requests are made by opening a connection, making a number of them then closing it. In this occurance, the connection times out but is not recognized as closed and thus a new connection is not established for the next request and an error is returned.

Setting the keepalive to false sets it to close and reopen connections for each request. This taxes the server quite a bit more (some 7 connections for each new request). I would welcome any solutions to this error that don't involve this much traffic but I have yet to find any and am reluctant to write around it.

The suggestions I found indicated that setting the keepalive should solve it, yet some suggested setting the http version to 1.0.

There are variations in how the 1.0 and 1.1 versions of how the protocol work. Officially, the version 1.0 doesn't support keep-alives, however some implementations do support it.

.Net is designed to use http 1.1 to make requests which encourages persistant connections. It is more likely you'll avoid the error by forcing the use of the 1.0 protocol as it didn't take advantage of persistant connections (multiple requests per connection), however I cannot say either way as to whether the error won't still occur with the version set as 1.1

For example, leaving it set to use the 1.1 protocol will likely not try to keep the connection alive, but may still try to send more requests per connection which may cause the error to happen, just less frequently.

Unfortunately I cannot track down the original microsoft documentation on this issue as it seems to have disappeared, so outside of studying the documented http 1.0 and 1.1 versions of the protocol, comparing them and studying the .net implementation, there isn't much you can do aside from setting both to avoid the error.

Fonte:
geekswithblogs.net/Denis/archive/2005/08/16/…

Sembra un bug del Framework effettivamente...
aaa
21/04/10 21:59
marco444
possibile soluzione?
magari un codice simile ma con le stesse funzioni, oppure un aggiornamento, o un codice per il 2.0, qualcosa per favore.
aaa
22/04/10 13:48
marco444
nessuno??
aaa
22/04/10 17:10
Il Totem
The suggestions I found indicated that setting the keepalive should solve it, yet some suggested setting the http version to 1.0.

Prova...
msdn.microsoft.com/en-us/library/…
aaa