Startup.cs 1.4 KB

123456789101112131415161718192021222324252627282930313233343536373839
  1. using Masuit.Tools.Core.NoSQL;
  2. using Microsoft.AspNetCore.Builder;
  3. using Microsoft.AspNetCore.Hosting;
  4. using Microsoft.AspNetCore.Mvc;
  5. using Microsoft.Extensions.Configuration;
  6. using Microsoft.Extensions.DependencyInjection;
  7. namespace NetCoreTest
  8. {
  9. public class Startup
  10. {
  11. public Startup(IConfiguration configuration)
  12. {
  13. Configuration = configuration;
  14. }
  15. public IConfiguration Configuration { get; }
  16. // This method gets called by the runtime. Use this method to add services to the container.
  17. public void ConfigureServices(IServiceCollection services)
  18. {
  19. services.AddDefaultRedisHelper("192.168.16.145:6379,password=xilife2018,connectTimeout=1000,connectRetry=1,syncTimeout=1000");
  20. services.AddLocalRedisHelper();
  21. services.AddRedisHelper("aa", "192.168.16.145:6379,password=xilife2018,connectTimeout=1000,connectRetry=1,syncTimeout=1000");
  22. services.AddMvc().SetCompatibilityVersion(CompatibilityVersion.Version_2_1);
  23. }
  24. // This method gets called by the runtime. Use this method to configure the HTTP request pipeline.
  25. public void Configure(IApplicationBuilder app, IHostingEnvironment env)
  26. {
  27. if (env.IsDevelopment())
  28. {
  29. app.UseDeveloperExceptionPage();
  30. }
  31. app.UseMvcWithDefaultRoute();
  32. }
  33. }
  34. }