Questo sito utilizza cookies solo per scopi di autenticazione sul sito e nient'altro. Nessuna informazione personale viene tracciata. Leggi l'informativa sui cookies.
Username: Password: oppure
C# / VB.NET - [VBS.NET]Caricare file tramite protocollo ftp (Eccezione durante una richiesta WebClient)
Forum - C# / VB.NET - [VBS.NET]Caricare file tramite protocollo ftp (Eccezione durante una richiesta WebClient)

Avatar
lord_texter (Normal User)
Rookie


Messaggi: 36
Iscritto: 11/01/2011

Segnala al moderatore
Postato alle 22:07
Sabato, 07/05/2011
Questo topic è stato chiuso dal moderatore

Salve a tutti stavo realizzando un programma per la catalogazione di dati che caricasse degli archivi online su un server ftp.
ho sempre usato il seguente codice:
Codice sorgente - presumibilmente VB.NET

  1. Dim up As New Net.WebClient
  2.         up.Credentials = New NetworkCredential("username", "password")
  3.         up.UploadFile("ftp://ftp.sito.org/database/archivioi.rar", "archivioi.rar")



ovviamente dichiarando prima:
Codice sorgente - presumibilmente C# / VB.NET

  1. Imports System.Net



Andava tutto a gonfie vele fino a ieri quando ho avviato il debug del programma per verificare altre funzioni che avevo aggiunto (ma che non hanno nulla a che fare con l'invio di dati o col form dal quale parte la webrequest), mi è apparso il tristissimo messaggio: "Eccezione durante una richiesta WebClient"
Da quel momento non c'è stato modo di rimediare, mi da sempre lo stesso errore. Il dilemma è che però in precedenza funzionava quindi non riesco proprio a spiegarmi questo fatto.
Premetto che il server ftp e su altervista, pensavo fosse un problema del server momentaneo, magari causato da qualche attacco Ddos, ma non è così...qualcuno saprebbe come risolvere?

PM
Avatar
HeDo (Founder Member)
Guru^2


Messaggi: 2765
Iscritto: 21/09/2007

Segnala al moderatore
Postato alle 22:47
Sabato, 07/05/2011

posta l'intero oggetto exception, così è abbastanza difficile dire cos'è.

PM
Avatar
lord_texter (Normal User)
Rookie


Messaggi: 36
Iscritto: 11/01/2011

Segnala al moderatore
Postato alle 23:02
Sabato, 07/05/2011
ecco i dettagli/eccezioni dell'errore:
Codice sorgente - presumibilmente Delphi

  1. System.Net.WebException non è stata gestita
  2.   Message=Eccezione durante una richiesta WebClient.
  3.   Source=System
  4.   StackTrace:
  5.        in System.Net.WebClient.UploadFile(Uri address, String method, String fileName)
  6.        in System.Net.WebClient.UploadFile(String address, String fileName)
  7.        in WindowsApplication1.web.Button1_Click(Object sender, EventArgs e) in C:\Users\pro\documents\visual studio 2010\Projects\progetto database clienti\progetto database clienti\web.vb:riga 14
  8.        in System.Windows.Forms.Control.OnClick(EventArgs e)
  9.        in System.Windows.Forms.Button.OnClick(EventArgs e)
  10.        in System.Windows.Forms.Button.OnMouseUp(MouseEventArgs mevent)
  11.        in System.Windows.Forms.Control.WmMouseUp(Message& m, MouseButtons button, Int32 clicks)
  12.        in System.Windows.Forms.Control.WndProc(Message& m)
  13.        in System.Windows.Forms.ButtonBase.WndProc(Message& m)
  14.        in System.Windows.Forms.Button.WndProc(Message& m)
  15.        in System.Windows.Forms.Control.ControlNativeWindow.OnMessage(Message& m)
  16.        in System.Windows.Forms.Control.ControlNativeWindow.WndProc(Message& m)
  17.        in System.Windows.Forms.NativeWindow.DebuggableCallback(IntPtr hWnd, Int32 msg, IntPtr wparam, IntPtr lparam)
  18.        in System.Windows.Forms.UnsafeNativeMethods.DispatchMessageW(MSG& msg)
  19.        in System.Windows.Forms.Application.ComponentManager.System.Windows.Forms.UnsafeNativeMethods.IMsoComponentManager.FPushMessageLoop(IntPtr dwComponentID, Int32 reason, Int32 pvLoopData)
  20.        in System.Windows.Forms.Application.ThreadContext.RunMessageLoopInner(Int32 reason, ApplicationContext context)
  21.        in System.Windows.Forms.Application.ThreadContext.RunMessageLoop(Int32 reason, ApplicationContext context)
  22.        in System.Windows.Forms.Application.Run(ApplicationContext context)
  23.        in Microsoft.VisualBasic.ApplicationServices.WindowsFormsApplicationBase.OnRun()
  24.        in Microsoft.VisualBasic.ApplicationServices.WindowsFormsApplicationBase.DoApplicationModel()
  25.        in Microsoft.VisualBasic.ApplicationServices.WindowsFormsApplicationBase.Run(String[] commandLine)
  26.        in WindowsApplication1.My.MyApplication.Main(String[] Args) in 17d14f5c-a337-4978-8281-53493378c1071.vb:riga 81
  27.        in System.AppDomain._nExecuteAssembly(RuntimeAssembly assembly, String[] args)
  28.        in System.AppDomain.ExecuteAssembly(String assemblyFile, Evidence assemblySecurity, String[] args)
  29.        in Microsoft.VisualStudio.HostingProcess.HostProc.RunUsersAssembly()
  30.        in System.Threading.ThreadHelper.ThreadStart_Context(Object state)
  31.        in System.Threading.ExecutionContext.Run(ExecutionContext executionContext, ContextCallback callback, Object state, Boolean ignoreSyncCtx)
  32.        in System.Threading.ExecutionContext.Run(ExecutionContext executionContext, ContextCallback callback, Object state)
  33.        in System.Threading.ThreadHelper.ThreadStart()
  34.   InnerException: System.IO.FileNotFoundException
  35.        FileName=C:\Users\pro\documents\visual studio 2010\Projects\progetto database clienti\progetto database clienti\bin\Debug\archivio_clienti_ordini.rar
  36.        Message=Impossibile trovare il file 'C:\Users\pro\documents\visual studio 2010\Projects\progetto database clienti\progetto database clienti\bin\Debug\archivio_clienti_ordini.rar'.
  37.        Source=mscorlib
  38.        StackTrace:
  39.             in System.IO.__Error.WinIOError(Int32 errorCode, String maybeFullPath)
  40.             in System.IO.FileStream.Init(String path, FileMode mode, FileAccess access, Int32 rights, Boolean useRights, FileShare share, Int32 bufferSize, FileOptions options, SECURITY_ATTRIBUTES secAttrs, String msgPath, Boolean bFromProxy, Boolean useLongPath)
  41.             in System.IO.FileStream..ctor(String path, FileMode mode, FileAccess access)
  42.             in System.Net.WebClient.OpenFileInternal(Boolean needsHeaderAndBoundary, String fileName, FileStream& fs, Byte[]& buffer, Byte[]& formHeaderBytes, Byte[]& boundaryBytes)
  43.             in System.Net.WebClient.UploadFile(Uri address, String method, String fileName)
  44.        InnerException:


PM
Avatar
lord_texter (Normal User)
Rookie


Messaggi: 36
Iscritto: 11/01/2011

Segnala al moderatore
Postato alle 23:06
Sabato, 07/05/2011
ho trovato da solo l'errore...il file archivi.rar era rinominato male: invece di archivio.rar era chiamato archivio.rar.rar    Mi scuso per la discussione inutile ed idiota che ho aperto!!  :pat:

PM
Avatar
HeDo (Founder Member)
Guru^2


Messaggi: 2765
Iscritto: 21/09/2007

Segnala al moderatore
Postato alle 2:49
Domenica, 08/05/2011
a volte basta veramente solo analizzare più a fondo l'eccezione restituita per risolvere il problema!

PM