Last post Jul 15, 2011 02:57 PM by princeG
Jul 15, 2011 12:42 PM|fig0000|LINK
Pretty new to httphandlers. Essentially I'm loading pdf images from a database into an array as bitmaps and saving them back out after they've been annotated; they are converted back to pdf format using third party software and then saved back ot the database.
This is done by passing the bitmap data to an httphandler that converts the binary data back to pdf format and then uses ado.net to save the modified pdf back to the database. I am using the httphandler because the binary data is gathered in a silverlight
program and, at the time I wrote this, I was not good enough at wcf. The "easy" way to save data to the database at the time was to use an http handler.
When I did this originally my proof of concept worked; I was only saving one pdf and everything was fine. Now I am saving multiple pdfs and I find that, for the three pdfs I am using to test this, the third one in the sequence that is passed to the httphandler
gets saved fine. For the first two pdfs that are passed to the http handler they are overwritten with a pretty corrupted version fo the third pdf. Obviously this is not thread safe.
I have tried this with IsResusable set to false and true. Either way I get the result described above. Since I'm not that experienced with httphandlers, I'm not certain I can process multiple pdfs this way, though I would think that there must be a way for
httphandlers to be threadsafe. It's clear that all three calls to the httphandler are receiving the same stream: the one for the third pdf. I checked the byte count of the recieved stream in all three calls as the code went into the httphandler and it is the
same for all three. Do I need to bail out of the httphandler and use wcf or will I be creating different problems doing that?
Any help would be appreciated.
Jul 15, 2011 02:57 PM|princeG|LINK
Check here: http://stackoverflow.com/questions/3720046/setting-httphandler-isreusable-property