public bool Open() { try { ServiceState.RegisterStartupCondition(STARTUP_CONDITION); Log.Debug("Opening MPExtended ServiceHost version {0}", VersionUtil.GetFullVersionString()); // always log uncaught exceptions that cause the program to exit AppDomain.CurrentDomain.UnhandledException += delegate(object sender, UnhandledExceptionEventArgs e) { Log.Error("Unhandled exception", (Exception)e.ExceptionObject); if (e.IsTerminating) { Log.Fatal("Terminating because of previous exception"); } }; // set the thread locale to English; we don't output any user-facing messages from the service anyway. Thread.CurrentThread.CurrentCulture = CultureInfo.InvariantCulture; Thread.CurrentThread.CurrentUICulture = CultureInfo.InvariantCulture; // TODO: Set CultureInfo.DefaultThreadCurrent{,UI}Culture when we switch to .NET4.5 // setup our environment EnvironmentSetup.SetupEnvironment(); // start watching the configuration files for changes Configuration.Load(); Configuration.EnableChangeWatching(); // reload logger configuration, now that we can load the diagnostic section from the configuration Log.TraceLogging = Configuration.Services.Diagnostic.EnableTraceLogging; Log.Setup(); // load and host all services foreach (var service in ServiceInstallation.Instance.GetServices()) { Task.Factory.StartNew(StartService, (object)service); } wcfHost = new WCFHost(); wcfHost.Start(ServiceInstallation.Instance.GetWcfServices()); // ensure a service dependency on the TVEngine is set Task.Factory.StartNew(() => TVEDependencyInstaller.EnsureDependencyStatus(TVEDependencyInstaller.DependencyStatus.NoDependencySet)); // log system version details Mediaportal.LogVersionDetails(); Log.Debug("Running on CLR {0} on {1}", Environment.Version, Environment.OSVersion); // finish ServiceState.StartupConditionCompleted(STARTUP_CONDITION); Log.Trace("Opened MPExtended ServiceHost"); return(true); } catch (Exception ex) { Log.Error("Failed to open MPExtended ServiceHost", ex); return(false); } }
public MPExtendedHost() { Thread.CurrentThread.Name = "HostThread"; wcf = new WCFHost(); }
public MPExtendedHost() { Thread.CurrentThread.Name = "HostThread"; wcf = new WCFHost(); zeroconf = new Zeroconf(); }
public bool Open() { try { ServiceState.RegisterStartupCondition(STARTUP_CONDITION); Log.Debug("Opening MPExtended ServiceHost version {0}", VersionUtil.GetFullVersionString()); // always log uncaught exceptions that cause the program to exit AppDomain.CurrentDomain.UnhandledException += delegate(object sender, UnhandledExceptionEventArgs e) { Log.Error("Unhandled exception", (Exception)e.ExceptionObject); if (e.IsTerminating) { Log.Fatal("Terminating because of previous exception"); } }; // set the thread locale to English; we don't output any user-facing messages from the service anyway. Thread.CurrentThread.CurrentCulture = CultureInfo.InvariantCulture; Thread.CurrentThread.CurrentUICulture = CultureInfo.InvariantCulture; // TODO: Set CultureInfo.DefaultThreadCurrent{,UI}Culture when we switch to .NET4.5 // setup our environment EnvironmentChecks.CheckEnvironment(); // start watching the configuration files for changes Configuration.Load(); Configuration.EnableChangeWatching(); // load and host all services foreach (var service in ServiceInstallation.Instance.GetServices()) Task.Factory.StartNew(CreateServiceHost, (object)service); wcfHost = new WCFHost(); wcfHost.Start(ServiceInstallation.Instance.GetWcfServices()); // ensure a service dependency on the TVEngine is set Task.Factory.StartNew(() => TVEDependencyInstaller.EnsureDependencyStatus(TVEDependencyInstaller.DependencyStatus.NoDependencySet)); // log system version details Mediaportal.LogVersionDetails(); Log.Debug("Running on CLR {0} on {1}", Environment.Version, Environment.OSVersion); // finish ServiceState.StartupConditionCompleted(STARTUP_CONDITION); Log.Trace("Opened MPExtended ServiceHost"); return true; } catch (Exception ex) { Log.Error("Failed to open MPExtended ServiceHost", ex); return false; } }
public MPExtendedHost() { Thread.CurrentThread.Name = "HostThread"; wcfHost = new WCFHost(); }