I’m working on a stock-standard, ASP.NET MVC 3 web application (hosted on IIS 7). The site allows users to upload photos, among other things.
The upload process is as follows:
- User makes use of widget (currently plupload) to select files from their PC.
- AJAX call happens to my server, with image in HTTP POST (Request.Files)
- Server resizes photo N amount of times
- Each resized photo is uploaded to Amazon S3
At the moment, the above is implemented with a “fire and forget” technique using .NET 4.0’s TPL.
I would like to make the above more flexible and robust. For example, if the image processing fails (it’s using GDI, so it’s likely), or S3 is down (which happens), i or the user won’t know about it.
I’m thinking about hosting a WCF service as a Windows Service, which polls a folder for images.
My main website would simply FTP the image to the “watched” folder, then the service would take care of the image processing and the uploading.
The user doesn’t need to be notified “immediately” that the photo is done. In other words, right now we show a “your image is being processed and will be available shortly” message.
To sum up, the service needs to:
- Resize images
- Upload images to S3
- Read/write to database
- Ability to “retry” failed images
Any advice? Is FileSystemWatcher a good option?
In my current project we implemented a similar middleware service responsible for data processing using FileSystemWatcher with relative success. Some things to remember about:
Hope this helps and good luck.