Connecting Silverlight to the local computers COM port
I have been searching high and low for a way to get my silverlight application talking to the COM port on my local computer. Has anybody out there been able to get Silverlight to successfully connect to the COM port of you local computer? If so can you point me to the documentation.
You can connect Silverlight 5 to the local Comm Port as well as any other local resource, but only with the Silverlight application is running under Windows (not Mac) and when running either OOB (out-of-browser) or in-browser in Internet Explorer.
The way this is done is by creating a classic COM automation component, and running the application with Full Trust. There is a registry key you can set to allow Silverlight 5 applications to be able to run with full trust in-browser, but the application must be signed and the public key must be imported to trusted publishers on the local machine.
Once done, Silverlight supports AutomactionFactory, allowing you to access locally registered com automation objects. We use this feature extensively; it is very powerful. In this case we created a COM component that gives access to the SerialPort object, and gave it a method to return a list of all available ports.
If AutomationFactory.IsAvailable Then
SilPort = AutomationFactory.CreateObject("SilverPort.Ports")
Dim AllPorts() As String
AllPorts = SilPort.GetPortNames()