示例#1
0
        // This method gets called by the runtime. Use this method to configure the HTTP request pipeline.
        public void Configure(IApplicationBuilder app, IWebHostEnvironment env, IDistributeCacheRepository cache)
        {
            // Set cache when starting service
            var currentTimeUTC = DateTime.UtcNow.ToString();

            cache.UpSert("cachedTimeUTC", currentTimeUTC);

            if (env.IsDevelopment())
            {
                app.UseDeveloperExceptionPage();
            }
            else
            {
                app.UseExceptionHandler("/Error");
            }

            // app.UseHttpsRedirection();

            app.UseRouting();

            app.UseAuthorization();

            app.UseStaticFiles();

            app.UseEndpoints(endpoints =>
            {
                endpoints.MapRazorPages();
            });
        }
 public IndexModel(IDistributeCacheRepository cache)
 {
     _cache = cache;
 }