I have a C# form application that connects to a electronic device using the serial port. The class "'SerialCommunicationManager'" hooks up to the serial port on application startup and handles the dirty business of talkning to the device.
What I would like is to expose the following methods.
Primarily a local website running on the same machine is the one I want to expose the methods for, but in the future I imagine the need for external applications as well.
What is the easiest way to expose the functionality?
Big thanks
//David
I would recommend self-hosting a WCF Service . This provides you a huge amount of flexibility in terms of how you serve and expose this information, including being able to change the method by which its served via configuration.
It seems to me, that if you would like to do it properly, you should break apart your forms app, and create:
Then, depending on the locality of your web site, if it will remain local (or near local - LAN):
else, if you plan to have multiple web sites:
However, if it is too much work to do - just use remoting and expose needed methods to the web site.
In a recent project we did the following:
In this context, I could imagine the website you are mentioning to also use Web Services (WSDL) to communicate with the Console application.
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.