public WCFService(SipServerConfigurationSection configuration, EnhancedPresence1 enhancedPresence, TrunkManager trunkManager, Accountx accounts, IUserz userz) { this.accounts = accounts; this.userz = userz; this.userz.Reset += IUsers_Reloaded; this.userz.Added += IUsers_Added; this.userz.Updated += IUsers_Updated; this.userz.Removed += IUsers_Removed; this.enhancedPresence = enhancedPresence; this.enhancedPresence.AvailabilityChanged += AvailabilityChanged; this.trunkManager = trunkManager; this.trunkManager.TrunkUpdated += TrunkUpdated; this.serviceAddress = configuration.WcfServiceAddress; //this.domainName = configuration.DomainName; this.validator = new CustomUserNamePasswordValidator(@"administrator", configuration.AdministratorPassword); }
public WCFService(SipServerConfigurationSection configuration, EnhancedPresence1 enhancedPresence, TrunkManager trunkManager, Accountx accounts, IUserz userz) { this.accounts = accounts; this.userz = userz; this.userz.Reset += IUsers_Reloaded; this.userz.Added += IUsers_Added; this.userz.Updated += IUsers_Updated; this.userz.Removed += IUsers_Removed; this.enhancedPresence = enhancedPresence; this.enhancedPresence.AvailabilityChanged += AvailabilityChanged; this.trunkManager = trunkManager; this.trunkManager.TrunkUpdated += TrunkUpdated; this.serviceAddress = configuration.WcfServiceAddress; //this.domainName = configuration.DomainName; this.validator = new CustomUserNamePasswordValidator(@"administrator", configuration.AdministratorPassword); }
public void Start() { try { serviceHost = new ServiceHost(this, new Uri(ServiceUri)); var validator = new CustomUserNamePasswordValidator(ServiceSettings); serviceHost.Credentials.ServiceCertificate.Certificate = new X509Certificate2(PfxPathName, ""); serviceHost.Credentials.UserNameAuthentication.UserNamePasswordValidationMode = UserNamePasswordValidationMode.Custom; serviceHost.Credentials.UserNameAuthentication.CustomUserNamePasswordValidator = validator; var binding = new NetTcpBinding(); binding.Security.Mode = SecurityMode.Message; binding.Security.Message.ClientCredentialType = MessageCredentialType.UserName; serviceHost.Description.Behaviors.Add(new ServiceMetadataBehavior()); serviceHost.AddServiceEndpoint(typeof(IWcfTurnService), binding, ""); serviceHost.AddServiceEndpoint(typeof(IMetadataExchange), MetadataExchangeBindings.CreateMexTcpBinding(), "mex"); serviceHost.Open(); } catch { serviceHost = null; throw; } }