Nie możesz wybrać więcej, niż 25 tematów Tematy muszą się zaczynać od litery lub cyfry, mogą zawierać myślniki ('-') i mogą mieć do 35 znaków.
 
 
 

43 wiersze
1.3 KiB

  1. using System;
  2. using System.Collections.Generic;
  3. using System.Linq;
  4. using System.Threading.Tasks;
  5. using Microsoft.AspNetCore.Builder;
  6. using Microsoft.AspNetCore.Hosting;
  7. using Microsoft.Extensions.DependencyInjection;
  8. namespace Sample.RabbitMQ.PostgreSql
  9. {
  10. public class Startup
  11. {
  12. // This method gets called by the runtime. Use this method to add services to the container.
  13. public void ConfigureServices(IServiceCollection services)
  14. {
  15. services.AddDbContext<AppDbContext>();
  16. services.AddCap(x =>
  17. {
  18. x.UseEntityFramework<AppDbContext>();
  19. x.UseRabbitMQ("localhost");
  20. x.UseDashboard();
  21. x.UseDiscovery(d =>
  22. {
  23. d.DiscoveryServerHostName = "localhost";
  24. d.DiscoveryServerPort = 8500;
  25. d.CurrentNodeHostName = "localhost";
  26. d.CurrentNodePort = 5800;
  27. d.NodeName = "CAP 一号节点";
  28. });
  29. });
  30. services.AddMvc();
  31. }
  32. // This method gets called by the runtime. Use this method to configure the HTTP request pipeline.
  33. public void Configure(IApplicationBuilder app, IHostingEnvironment env)
  34. {
  35. app.UseMvc();
  36. app.UseCap();
  37. }
  38. }
  39. }