Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <p>I don't know specifically what error you're getting when closing the stream, but in our application, we do a lot of large file uploads (videos and images). Here's how we write to our FTP stream:</p> <pre><code>request.KeepAlive = false; // This eliminated some of our stream closing problems using (Stream stream = request.GetRequestStream()) { stream.Write(file.Data, 0, file.Data.Length); } </code></pre> <p>I thought that doing a <code>using</code> block would effectively do the <code>Close</code> call on its own, but maybe it also performs other necessary cleanup. Also notice I turned off the FTP keepalives, which caused us problems in some of the third-party FTP sites we uploaded to.</p> <p>You really should look at the specific exception you're receiving rather than swallowing all exceptions. The error message will most-likely tell you what's wrong. The most common problems we encountered had to do with active vs. passive mode and the keepalives.</p> <p><strong>Edit:</strong></p> <p>To discover what was really going on when we had FTP issues with CDNs (and it happens way too frequently), we sometimes had to turn tracing on in our application. See <a href="http://msdn.microsoft.com/en-us/library/ty48b824.aspx" rel="nofollow noreferrer">this link</a> for details on how to enable tracing. Another option is to use a tool like Wireshark to sniff the conversation between your application and the FTP server. If you can see what's going in in the FTP protocol, you'll have a much better chance of resolving the issue.</p>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. VO
      singulars
      1. This table or related slice is empty.
    2. VO
      singulars
      1. This table or related slice is empty.
    3. VO
      singulars
      1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload