示例#1
0
        //-----------------------------------------------------------------------------------------------------------------------------------------------------

        private void RunMicroservice()
        {
            try
            {
                LogImportant($"run > {_microserviceFolderPath}");

                var bootConfig = BootConfiguration.LoadFromFiles(_microserviceFilePath, _environmentFilePath);
                bootConfig.ConfigsDirectory = _microserviceFolderPath;

                if (_noPublish)
                {
                    MapAssemblyLocationsFromSources(bootConfig);
                }

                using (var host = new MicroserviceHost(bootConfig, new MicroserviceHostLoggerMock()))
                {
                    host.Configure();
                    host.LoadAndActivate();

                    LogSuccess("Microservice is up.");
                    LogSuccess("Press ENTER to go down.");

                    Console.ReadLine();

                    host.DeactivateAndUnload();
                }
            }
            catch (Exception ex)
            {
                ReportFatalError(ex);
            }
        }