Hello everyone,
I'm absolutely loving my Netduino Plus 2! But I am having some serious trouble trying to get a WCF service hosted on my hardware. As I read the .Net Micro Framework 4.3 SDK docs, it appears that most of the difficult stuff like worrying about WSDL files/discovery/etc are taken care of under the hood (which is great and how it's done in full .net). That said, I cannot seem to get my service up and running...or find any examples of people doing the same thing in this specific version of .Net MF.
My service is here:
[ServiceContract] public interface IBriansWCFService { [OperationContract] void LED1(bool value); [OperationContract] void SendSerialMsg(string message); } public class MyService : DpwsHostedService, IBriansWCFService { private MySerialPort sPort; private MyBoard mBoard; public MyService(ProtocolVersion pVersion) : base(pVersion) { sPort = new MySerialPort(); mBoard = new MyBoard(); } public void LED1(bool value) { throw new NotImplementedException(); } public void SendSerialMsg(string message) { throw new NotImplementedException(); } }
As you can see, I developed a simple DpwsHostedService. This part, for me, was straight forward as it is almost identical to how you develop services in full .NET.
It's the next part that is confusing (a little bit ambiguous in the docs) and where I believe I'm having my problems.
First, whenever I add my instantiated service to the Device.HostedServices stack, it throws a null pointer exception...so I commented this out. Once commented, if I try and execute the Device.start method, it throws another (but different) type of exception.
I was hoping that this community might be able to shed some light on what I'm missing and doing wrong. This rally isn't far off from how you do this in full .NET and so I fell I'm missing something small but crucial.
Can you awesome people help me?
Thanks!