Ok, I've got an update...I was able to figure out why setting up my Device.Host was throwing exceptions. But unfortunately, I'm still stuck on the Device.Start method as it asks for a ServerBindingContext which in turn asks for BindingProperties. What are BindingProperties and how to I get access to these? Creating BindingProperties requires you to know the name, container, and value which doesn't make sense to me .
Here is my updated Service:
[ServiceContract] public interface IBriansWCFService { [OperationContract] void LED1(bool value); } public class MyService : DpwsHostedService, IBriansWCFService { private MyBoard mBoard; public MyService(ProtocolVersion pVersion) : base(pVersion) { mBoard = new MyBoard(); ServiceTypeName = "BrianSimpleService"; string sid = "urn:uuid:" + Guid.NewGuid().ToString(); ServiceID = sid; } public void LED1(bool value) { mBoard.LED1 = value; } }
And here is my updated Main:
public static void Main() { WS2007HttpBinding binding = new WS2007HttpBinding(); ProtocolVersion11 protocol = new ProtocolVersion11(); Device.Initialize(binding, protocol); MyService mService = new MyService(protocol); Device.Host = mService; Device.IgnoreLocalClientRequest = true; Debug.Print(Device.IPV4Address); while (true) { try { Device.Start(new ServerBindingContext(protocol, (BindingProperty)binding.Elements.GetBindingProperty(""))); } catch (Exception ex) { Debug.Print(ex.Message); } }
I truly appreciate any help. I've been banging my head against the wall on this for hours!
Thanks!