Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Using FTP and clearing out memory
Message
De
25/04/2013 15:03:08
 
 
À
25/04/2013 14:39:55
Information générale
Forum:
ASP.NET
Catégorie:
Autre
Versions des environnements
Environment:
VB 9.0
OS:
Windows 7
Network:
Windows 2003 Server
Database:
MS SQL Server
Application:
Web
Divers
Thread ID:
01571897
Message ID:
01571906
Vues:
31
>I am not sure it this could help but it cannot hurt, I am using the Using\End Using approach to encapsulate the StreamReader class:
>
>
>                        ' FTP setup
>                        loFtpWebRequest = System.Net.FtpWebRequest.Create(New Uri(lcURI))
>                        loFtpWebRequest.Credentials = New System.Net.NetworkCredential(cUsername, cPassword)
>                        loFtpWebRequest.Method = System.Net.WebRequestMethods.Ftp.ListDirectoryDetails
>
>                        ' If we use FTP/SSL  (AUTH SSL)
>                        If nNoFTPProtocol = 2 Then
>                            loFtpWebRequest.EnableSsl = True
>                        End If
>
>                        loFtpWebResponse = loFtpWebRequest.GetResponse()
>
>                        Using loStreamReader As New StreamReader(loFtpWebResponse.GetResponseStream())
>
>                            ' Load the files into the string builder
>                            loStringBuilder.LoadString(loStreamReader.ReadToEnd())
>
>                        End Using
>
>
>This is the part that deals with memory so maybe this could have been a factor.


I was going to suggest something similar

In addition to Disposing of the StreamReader, I think you need to do the same for
loFtpWebResponse.GetResponseStream()  // the stream
loFtpWebResponse 
In addition, could you reuse the following (rather than instantiating each time)
New Uri(lcURI)
New System.Net.NetworkCredential(cUsername, cPassword)
Gregory
Précédent
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform