tags:

views:

62

answers:

1

ASP.NET 2.0 and COM Port Communication

Hello Guys,

I have a managed DLL which communicates with the devices attached on COM/Serial ports. The desktop Winforms application sends requests on ports and receives/stores data in memory. In Winforms app I have added a reference to DLL and I am using the methods. This works well. Now, there is a situation where I need to show this data from serial/com port on a web-page. And also users should be able to send requests to the ports using this DLL.

I have made a web app in ASP.NET (2.0). Added a reference to the DLL. I am able to use this DLL, the DLL communicates on the COM upon button click on web-page and also the response is shown on web page.

However I am not happy with the approach and strongly feel that this is a bad approach. Also the development server crashes after 3 -4 requests.

What is the best approach in this scenario. If I use a windows service then how would my ASP.net app will communicate with the Weindows service.

Or can this be easily done using WCF. I have not used WCF any time nor any of .net remoting technique.

Please suggest me the best architecture in this scenario.

Thank you

+1  A: 

Phew, this takes me back a few years. COM ports!? Not in the travel industry are you?

Ok, I would recommend building a web service wrapper around your COM port as you suggest and then querying it from your asp.net page.

The sweetest way to do this would be using AJAX allowing the webpage to continually query the service and update without refresh when new input is received on the port.

Using the COM port on the asp page itself is asking for trouble just because the COM port itself can be tempremental. Hidden away on the server is better.

Also be careful of multiple requests to the same page - COM ports were around before multi-tasking :)

CResults
@CResults:: Yes I am in travel/transport domain. You guessed it right!!! I will try what you are saying. Yes i am using AJAX for updating reply from com port. ...and YES that the critical task to make sure only one request is making use of COM port .... well to make my job easy we have 4 -5 COM ports to select from available/free ports...
@CResults are you wearing a blue shirt? +1 for reading between the lines.
kenny