You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 

47 lines
1.4 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.AddCap(x =>
  16. {
  17. x.UseEntityFramework<AppDbContext>();
  18. x.UseRabbitMQ(z =>
  19. {
  20. z.HostName = "192.168.2.206";
  21. z.UserName = "admin";
  22. z.Password = "123123";
  23. });
  24. x.UseDashboard();
  25. x.UseDiscovery(d =>
  26. {
  27. d.DiscoveryServerHostName = "localhost";
  28. d.DiscoveryServerPort = 8500;
  29. d.CurrentNodeHostName = "localhost";
  30. d.CurrentNodePort = 5800;
  31. d.NodeName = "CAP一号节点";
  32. });
  33. });
  34. services.AddMvc();
  35. }
  36. // This method gets called by the runtime. Use this method to configure the HTTP request pipeline.
  37. public void Configure(IApplicationBuilder app, IHostingEnvironment env)
  38. {
  39. app.UseMvc();
  40. app.UseCap();
  41. }
  42. }
  43. }