private void InitService(string solutionName, string solutionPassword, string servicePath, Type serviceType, string protocol) { Uri address = ServiceBusEnvironment.CreateServiceUri(protocol, solutionName, servicePath); ServiceUri = address.ToString(); TransportClientEndpointBehavior behavior = ServiceBusHelper.GetUsernamePasswordBehavior(solutionName, solutionPassword); Host = new ServiceHost(serviceType, address); Host.Description.Endpoints[0].Behaviors.Add(behavior); ServiceRegistrySettings settings = new ServiceRegistrySettings(); settings.DiscoveryMode = DiscoveryType.Public; settings.DisplayName = address.ToString(); foreach (ServiceEndpoint se in Host.Description.Endpoints) { se.Behaviors.Add(settings); } Host.Open(); }