Netduino home hardware projects downloads community

Jump to content


The Netduino forums have been replaced by new forums at community.wildernesslabs.co. This site has been preserved for archival purposes only and the ability to make new accounts or posts has been turned off.

bvince05

Member Since 26 Mar 2015
Offline Last Active Jun 10 2015 07:20 AM
-----

Posts I've Made

In Topic: WCF Service Host issues (.net MF 4.3)

01 April 2015 - 10:32 AM

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!


home    hardware    projects    downloads    community    where to buy    contact Copyright © 2016 Wilderness Labs Inc.  |  Legal   |   CC BY-SA
This webpage is licensed under a Creative Commons Attribution-ShareAlike License.