Ejemplo n.º 1
0
        public static ServiceEndpoint ConfigureStandardEndpoint(ContractDescription cd, ChannelEndpointElement element)
        {
            string kind = element.Kind;
            string endpointConfiguration      = element.EndpointConfiguration;
            EndpointCollectionElement section = ConfigUtil.StandardEndpointsSection[kind];

            if (section == null)
            {
                throw new ArgumentException(String.Format("standard endpoint section for '{0}' was not found.", kind));
            }
            StandardEndpointElement e    = GetDefaultStandardEndpointElement(section);
            ServiceEndpoint         inst = CreateServiceEndpoint(e, cd);

            foreach (StandardEndpointElement el in section.ConfiguredEndpoints)
            {
                if (el.Name == endpointConfiguration)
                {
                    el.InitializeAndValidate(element);
                    el.ApplyConfiguration(inst, element);
                    break;
                }
            }
            return(inst);
        }
Ejemplo n.º 2
0
 private static ServiceEndpoint CreateServiceEndpoint(StandardEndpointElement e, ContractDescription cd)
 {
     return((ServiceEndpoint)typeof(ContractDescription).GetMethod("CreateServiceEndpoint", BindingFlags.NonPublic | BindingFlags.Instance).Invoke(e, new object[] {
         cd
     }));
 }