Example #1
0
        public static void Refresh()
        {
            Log.Information("ServiceHelper Refresh called");

            RegistryWrapper.RestoreDefaultSettings(true);

            ISettings s = Settings.LoadSettings();

            ForceDNSJob.End();
            ForceDNSJob.Begin(s);
        }
Example #2
0
        public static void Initialize()
        {
            Log.Information("ServiceHelper Initialize called");

            if (UserHasAdminPrivileges() == false)
            {
                return;
            }

            ISettings s = Settings.LoadSettings();

            //TODO remove dns
            //FirewallRule.AllowConnection(true);

            RegistryWrapper.StartRegistryMonitor();

            ForceDNSJob.Begin(s);

            Log.Information("Initializing WCF Host");

            host = new ServiceHost(typeof(WCF), new Uri("http://localhost:8022/FDService"));

            ServiceMetadataBehavior smb = host.Description.Behaviors.Find <ServiceMetadataBehavior>();

            if (smb == null)
            {
                smb = new ServiceMetadataBehavior();
            }

            host.Description.Behaviors.Add(smb);

            host.AddServiceEndpoint(typeof(IWCF), new BasicHttpBinding(), "");

            host.Open();

            Log.Information("WCF Host status = " + host.State);
        }