// Service host startup logic. private static void Listen() { const int maxReceivedMessageSize = ushort.MaxValue; const int maxStringContentLength = ushort.MaxValue; var binding = new WSHttpBinding { MaxReceivedMessageSize = maxReceivedMessageSize, ReaderQuotas = { MaxStringContentLength = maxStringContentLength } }; var behavior = new ServiceMetadataBehavior { HttpGetEnabled = true, MetadataExporter = { PolicyVersion = PolicyVersion.Policy15 } }; serviceHost = new ExternalServiceHost(args, typeof(ExternalService), new Uri(ServiceUri)); serviceHost.AddServiceEndpoint(typeof(IExternalService), binding, string.Empty); serviceHost.Description.Behaviors.Add(behavior); serviceHost.Open(); }