// This method gets called by the runtime. Use this method to add services to the container. public void ConfigureServices(IServiceCollection services) { //services.AddMvc(); services.AddControllers(); services.AddAutoMapper(typeof(Startup)); int chosenDB = Configuration.GetValue("ChosenDB", 1); DataConfiguration.configure((DataProviderEnum)chosenDB, Configuration, services); ServiceConfiguration.configure(Configuration, services); RabbitMqConfiguration.configure(Configuration, services); services.AddCors(); // ******************** // Setup CORS // ******************** // var corsBuilder = new CorsPolicyBuilder(); // corsBuilder.AllowAnyHeader(); // corsBuilder.AllowAnyMethod(); // corsBuilder.AllowAnyOrigin(); // For anyone access. // //corsBuilder.WithOrigins("http://localhost:56573"); // for a specific url. Don't add a forward slash on the end! // corsBuilder.AllowCredentials(); // services.AddCors(options => // { // options.AddPolicy("SiteCorsPolicy", corsBuilder.Build()); // }); }
public void ConfigureServices(IServiceCollection services) { services.AddMvc(); //.SetCompatibilityVersion(CompatibilityVersion.Version_2_1); services.AddAutoMapper(); int chosenDB = Configuration.GetValue("ChosenDB", 0); DataConfiguration.configure((DataProviderEnum)chosenDB, Configuration, services); ServiceConfiguration.configure(Configuration, services); DtoValidatorConfiguration.configure(Configuration, services); AbstractClassConfiguration.configure(); services.AddCors(); services.AddMvc(); }