// This method gets called by the runtime. Use this method to add services to the container. public void ConfigureServices(IServiceCollection services) { //MongoClient mongoClient = new MongoClient(ConnectionUtils.ConnectionString(Configuration)); var clientSettings = MongoClientSettings.FromUrl(new MongoUrl(ConnectionUtils.ConnectionString(Configuration))); clientSettings.SslSettings = new SslSettings(); clientSettings.SslSettings.CheckCertificateRevocation = false; clientSettings.UseTls = true; clientSettings.VerifySslCertificate = false; clientSettings.SslSettings.ClientCertificates = new List <X509Certificate>() { new X509Certificate(@"cert.pem") }; var mongoClient = new MongoClient(clientSettings); services.AddSingleton(mongoClient); CronUtils cronUtils = new CronUtils(Configuration, mongoClient); cronUtils.Start(); services.AddControllers(); services.AddMvc(); services.AddMvcCore() .AddApiExplorer(); services.AddSwaggerGen(c => { c.SwaggerDoc("v1", new OpenApiInfo { Title = "InterviewTemplate.Api", Version = "v1" }); try{ c.IncludeXmlComments(Path.GetFullPath((File.Exists(@"interviewFXS.xml")) ? @"interviewFXS.xml" : @"interviewFXS.xml")); } catch { Console.Write("Not file .xml swagger api found"); } }); }