Exemple #1
0
        protected internal override ServiceEndpoint CreateServiceEndpoint(ContractDescription contractDescription)
        {
            if (contractDescription == null)
            {
                throw new ArgumentNullException("contractDescription");
            }
            DiscoveryVersion ver = null;

            switch (contractDescription.ContractType.Namespace)
            {
            case DiscoveryVersion.Namespace11:
                ver = DiscoveryVersion.WSDiscovery11;
                break;

            case DiscoveryVersion.NamespaceApril2005:
                ver = DiscoveryVersion.WSDiscoveryApril2005;
                break;

            case DiscoveryVersion.NamespaceCD1:
                ver = DiscoveryVersion.WSDiscoveryCD1;
                break;
            }
            var ret = new UdpAnnouncementEndpoint(ver, MulticastAddress);

            ret.MaxAnnouncementDelay = MaxAnnouncementDelay;
            TransportSettings.ApplyConfiguration(ret.TransportSettings);
            return(ret);
        }
Exemple #2
0
        protected override void OnApplyConfiguration(ServiceEndpoint endpoint, ServiceEndpointElement serviceEndpointElement)
        {
            if (endpoint == null)
            {
                throw new ArgumentNullException("endpoint");
            }
            var de = (AnnouncementEndpoint)endpoint;

            if (!de.DiscoveryVersion.Equals(DiscoveryVersion))
            {
                throw new ArgumentException("Argument AnnouncementEndpoint is initialized with different DiscoveryVersion");
            }
            de.MaxAnnouncementDelay = MaxAnnouncementDelay;
            de.Address = serviceEndpointElement.CreateEndpointAddress(); // it depends on InternalVisibleTo(System.ServiceModel)
            var be = (UdpTransportBindingElement)de.Binding.CreateBindingElements().First(b => b is UdpTransportBindingElement);

            TransportSettings.ApplyConfiguration(be.TransportSettings);
        }