// This method gets called by the runtime. Use this method to add services to the container. public void ConfigureServices(IServiceCollection services) { //Auth Settings JwtSecurityTokenHandler.DefaultInboundClaimTypeMap.Clear(); //This is usually how to pass cookies but cant at because it requires windows and isnt supported on azure //services.AddDataProtection() // .PersistKeysToFileSystem(new System.IO.DirectoryInfo(@"c:\temp-keys")) // .ProtectKeysWithDpapi() // .SetApplicationName("SharedCookies"); services.AddAuthentication("Cookies") .AddCookie("Cookies", options => { options.Cookie.Name = ".AspNet.SharedCookie"; options.Cookie.Domain = ".azurewebsites.net"; }); //DB Connection var conn = Configuration.GetConnectionString("DBConnection"); services.AddDbContext <MSProductsDB>(options => options.UseSqlServer(conn, OptionsBuilder => { OptionsBuilder.EnableRetryOnFailure(3, TimeSpan.FromSeconds(10), null); })); //Because the auth service isnt implimented, use this to nullify all the auth code in the service services.AddMvc(options => options.Filters.Add(new AllowAnonymousFilter())).SetCompatibilityVersion(CompatibilityVersion.Version_2_2); }
// This method gets called by the runtime. Use this method to add services to the container. public void ConfigureServices(IServiceCollection services) { services.AddMvc(); //Add Conn string to the db //DB Connection var conn = Configuration.GetConnectionString("DBConnection"); services.AddDbContext <VehicleDamageDB>(options => options.UseSqlServer(conn, OptionsBuilder => { OptionsBuilder.EnableRetryOnFailure(3, TimeSpan.FromSeconds(10), null); })); }