I have developed a windows forms application in vb.NET that handles Barcode scans (Barcode readers are set-up on a comm port – the application passes the codes scanned to an asp.net asmx web service that processes the scan and returns the result to the application).
The application is working great but I have been tasked with allowing the Barcode scanners to be used whilst the PC is logged off.
I have developed a prototype windows service in vb.net (.net framework 4.5) that will accept the barcode scans – currently this is writing the scan to the windows event log but this would connect to the web-service to process the scans.
This service is working with the PC logged off.
What I now need is an application that displays a user interface – i.e. I need to pop-up a window when a Barcode is scanned. I also want to be able to ‘read’ the collection of ‘Barcode Scanner’ objects that the service is handling so that they can be displayed to the user. I also need to be able to configure the windows service (set web service URL etc.).
Can anyone give me any advice on the best way of achieving this? Can the windows service ‘push’ information to a ‘client’? if so what is the mechanism for achieving this?
Can a windows service expose methods (e.g ‘GetScanners’ or ‘GetLastScan’)? How would you set this up?
Thanks for any ideas / suggestions!
Chris
I would recommend either of the following two options:
The first option is arguably the better one. It’s more flexible for future needs, providing a real-time method of communication with the service. However, WCF can require a significant learning curve, so if you aren’t already comfortable with WCF and option 2 meets your current needs, it’s not a bad solution.
WCF works essentially like web services, but it’s more powerful and far more configurable. It is the solution to use if you need to expose methods like ‘GetScanners’ from a windows service, as you suggested.