简体   繁体   中英

Uploading files to remote server

I am a WPF newbie and has little experience with C# thread programming. I am assigned a C# WPF application with multi-threading. The requirements for that application is to upload local big files to a destination folder named "ABC" that sits directly under the root disk driver (eg C:\\ABC) on a remote server that runs under Windows platform. I do not know the directions to go. Please advise. Thank you.

Follows are details about the requirements:

  1. Because each uploaded file size is big, there needs a separate thread to run the upload file function. I plan to use thread programming with async/await and Task object. Any idea?

  2. In WPF I do not know which WPF control to use for upload function. Please help.

  3. For destination folder "ABC", do I need to set its access permission explicitly?

  4. I should use async/await and Task, or BackgroundWorker class?

Update:

WPF application not WCF application. Sorry for my typo.

To transfer large files using WCF service over HTTP , you can use the following types of bindings:

  • wsHttpBinding
  • basicHttpBinding

In wsHttpBinding , we can set the TransferMode attribute as Buffered , but there is a disadvantage in using this approach for large files, because it needs to put the entire file in memory before uploading/downloading, A large buffer is required on both the web client and the WCF service host. However, this approach is very useful for transferring small files, securely.

In basicHTTPBinding we can use the TransferMode attribute as Streamed so that the file can be transferred in the form of chunks.

For more information follow this article: WCF Streaming: Upload/Download Files Over HTTP

and for transfering files over TCP/IP read below articls:

WCF TCP-based File Server

Sending Files using TCP

Large Message Transfer with WCF-Adapters Part 1

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM