Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

WCF Web Service: Upload a file, Process that file, Download that processed file back

Tags:

wcf

c#-3.0

I can handle the process that file part, but before I go crazy, has someone built a simple wcf service & client (running under windows services or IIS) that I can use to upload a file, and download that file back? with the fewest lines of code? (C# or VB)

compression & encryption would be cool, but i'll layer that on later!!

Thanks!!

like image 580
Scott Kramer Avatar asked Nov 03 '25 09:11

Scott Kramer


1 Answers

Depending how much time the processing takes, you might be better off using two methods in order to avoid running into timeout issues.

Also, I agree with Igor, you should use streams and not byte[]. Otherwise you will probably run into OutOfMemory Exceptions.

[ServiceContract]
public interface IFileService
{
  // returns a Guid which you can use later to request the processed files
  [OperationContract]
  Guid SendFileToProcess(stream streamedFile);

  [OperationContract]
  Stream GetProcessedFile(Guid fileId);

  // use this to poll whether the service has finished processing
  [OperationContract]
  bool IsFileProcessed(Guid fileId);
}
like image 60
flayn Avatar answered Nov 04 '25 23:11

flayn



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!