Reputation: 4165
I have a central web application which starts an iris scanning device on the users PC. Our clients install our scanner drivers so that can track people coming and going from their sites.
Here is where the problem lies. In order for the scan to complete there has to be a live reference to the COM object until it is done. However, once the scan starts the code continues on and returns from the local service call. At that point the context is lost and likely the memory gets marked for cleanup breaking the process.
Is seems like a bad idea to lock the WebAPI service and wait for some response internally potentially locking up and crashing the web app.
How can I architect this to handle the process in a robust manner while avoiding any applications from being locked up?
I was thinking to maybe create a windows service that runs constantly in the background wherein an AppDomain is loaded for each scan request. The requests could process while my web app was polling for state changes via the webservice.
Upvotes: 0
Views: 74
Reputation: 1507
I think you need just to wrap your COM
component object in a Singleton
class where it's only instantiated once. (Read this for more information about Singleton).
Also if you go with the windows service option, which is I think a very good idea, I would suggest to use SignlaR
to push messages between the client and the server. Windows service as a signalr client
Upvotes: 0