public static void Main(string[] args) { var logger = NLogBuilder.ConfigureNLog("nlog.config").GetCurrentClassLogger(); try { logger.Info("Starting up the service"); #region NtkCmsFactoryAutoMapperConfig WorkerMapperConfig.Register(NtkCmsFactoryAutoMapperConfig.binder); NtkCmsFactoryAutoMapperConfig.Initialize(); #endregion NtkCmsFactoryAutoMapperConfig #region NtkCmsFactoryIocConfig WorkerIocConfig.Register(NtkCmsFactoryIocConfig.binder); NtkCmsFactoryIocConfig.Initilizer(); var performanceLogTools = WorkerIocConfig.IocConfig.GetInstance <IPerformanceLogTools>(); performanceLogTools = new PerformanceLogTools(); var performanceTaskManager = WorkerIocConfig.IocConfig.GetInstance <IPerformanceTaskManager>(); performanceTaskManager = new PerformanceTaskManager(); #endregion NtkCmsFactoryIocConfig WorkerIocConfig.IocConfig.SetCmsConfiguration(appSettingRead()); CreateHostBuilder(args).Build().Run(); } catch (Exception ex) { logger.Fatal(ex, "There was a problem starting the serivce"); } finally { NLog.LogManager.Shutdown(); } }
// This method gets called by the runtime. Use this method to add services to the container. public void ConfigureServices(IServiceCollection services) { #region NtkCmsFactoryIocConfig WebApiIocConfig.Register(NtkCmsFactoryIocConfig.binder); NtkCmsFactoryIocConfig.RegisterConfigServiceCollection(services); NtkCmsFactoryIocConfig.Initilizer(); #endregion NtkCmsFactoryIocConfig cmsConfiguration = appSettingRead(); PerformanceLogStartup.ConfigureServices(services, cmsConfiguration); services.AddCors(o => o.AddPolicy("Policy", builder => { builder.AllowAnyOrigin() .AllowAnyMethod() .AllowAnyHeader(); })); services.AddSwaggerGen(c => { c.SwaggerDoc("v1", new OpenApiInfo { Title = "Ntk.Autoactiva.Greenvideo.WebApi v1", Version = "V1", }); var xmlFile = $"{Assembly.GetExecutingAssembly().GetName().Name}.xml"; var xmlPath = Path.Combine(AppContext.BaseDirectory, xmlFile); c.IncludeXmlComments(xmlPath); }); services.AddScoped <UploadPartAttribute>(); services.AddScoped <UploadCompeleteAttribute>(); services.AddControllers(); }