0

I offer users to download files using WCF Streams. Problem is that once file is downloaded (FileStream object is created) I can't delete that file with File.Delete(), it says it is being used by someone other. At client side after download I close stream. How to fix this?

mersadk
  • 337
  • 5
  • 19

1 Answers1

0

Your solution with "FileShare.Delete | FileShare.Read" is actually a workaround (the file handle will still not be closed). I suspect you use MessageContract that contains the Stream. In that case you have to actually do slightly more work to correctly dispose the stream, see this answer Stream as a return value in WCF - who disposes it?

Community
  • 1
  • 1
Peter Sladek
  • 900
  • 9
  • 8