Reputation: 8599
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 (e.g. 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:
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?
In WPF I do not know which WPF control to use for upload function. Please help.
For destination folder "ABC", do I need to set its access permission explicitly?
I should use async/await and Task, or BackgroundWorker class?
Update:
WPF application not WCF application. Sorry for my typo.
Upvotes: 0
Views: 1535
Reputation: 11554
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:
Large Message Transfer with WCF-Adapters Part 1
Upvotes: 1