ASP.NET 2.0 and COM Port Communication
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 i开发者_运维知识库s 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
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 :)
精彩评论