private static long GetMaxMessageSize(System.ServiceModel.Channels.Binding mexBinding)
 {
     TransportBindingElement element = mexBinding.CreateBindingElements().Find<TransportBindingElement>();
     if (element == null)
     {
         throw DiagnosticUtility.ExceptionUtility.ThrowHelperError(new InvalidOperationException(System.ServiceModel.SR.GetString("SFxBindingDoesNotHaveATransportBindingElement")));
     }
     return element.MaxReceivedMessageSize;
 }
 	private static string GetTransport(System.ServiceModel.Channels.Binding binding)
     {
         TransportBindingElement transport = binding.CreateBindingElements().Find<TransportBindingElement>();
         if (transport != null)
         {
             if (typeof(HttpTransportBindingElement) == transport.GetType())
             {
                 return "http://schemas.xmlsoap.org/soap/http";
             }
             if (typeof(HttpsTransportBindingElement) == transport.GetType())
             {
                 return "http://schemas.xmlsoap.org/soap/https";
             }
             if (typeof(TcpTransportBindingElement) == transport.GetType())
             {
                 return "http://schemas.microsoft.com/soap/tcp";
             }
             if (typeof(NamedPipeTransportBindingElement) == transport.GetType())
             {
                 return "http://schemas.microsoft.com/soap/named-pipe";
             }
             if (typeof(MsmqTransportBindingElement) == transport.GetType())
             {
                 return "http://schemas.microsoft.com/soap/msmq";
             }
         }
         return "";
     }
 private static string GetDefaultEndpoint(System.ServiceModel.Channels.Binding binding, string serviceName)
 {
     TransportBindingElement transport = binding.CreateBindingElements().Find<TransportBindingElement>();
     if (transport != null)
     {
         if (typeof(HttpTransportBindingElement) == transport.GetType())
         {
             UriBuilder ub = new UriBuilder(transport.Scheme, "localhost");
             ub.Path = serviceName;
             return ub.Uri.ToString();
         }
         if (typeof(HttpsTransportBindingElement) == transport.GetType())
         {
             UriBuilder ub = new UriBuilder(transport.Scheme, "localhost");
             ub.Path = serviceName;
             return ub.Uri.ToString();
         }
         if (typeof(TcpTransportBindingElement) == transport.GetType())
         {
             UriBuilder ub = new UriBuilder(transport.Scheme, "localhost");
             ub.Path = serviceName;
             return ub.Uri.ToString();
         }
         if (typeof(NamedPipeTransportBindingElement) == transport.GetType())
         {
             return "tbd";
         }
         if (typeof(MsmqTransportBindingElement) == transport.GetType())
         {
             return "tbd";
         }
     }
     return "";
 }
 private static bool IsWsdlExportable(System.ServiceModel.Channels.Binding binding)
 {
     BindingElementCollection elements = binding.CreateBindingElements();
     if (elements != null)
     {
         foreach (BindingElement element in elements)
         {
             MessageEncodingBindingElement element2 = element as MessageEncodingBindingElement;
             if ((element2 != null) && !element2.IsWsdlExportable)
             {
                 return false;
             }
         }
     }
     return true;
 }