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.
 
 
 

52 wiersze
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. using Microsoft.Extensions.Logging;
  9. namespace Sample.RabbitMQ.MySql
  10. {
  11. public class Startup
  12. {
  13. public void ConfigureServices(IServiceCollection services)
  14. {
  15. services.AddDbContext<AppDbContext>();
  16. services.AddCap(x =>
  17. {
  18. x.UseEntityFramework<AppDbContext>();
  19. x.UseRabbitMQ(y => {
  20. y.HostName = "192.168.2.206";
  21. y.UserName = "admin";
  22. y.Password = "123123";
  23. });
  24. x.UseDashboard();
  25. x.UseDiscovery(d =>
  26. {
  27. d.DiscoveryServerHostName = "localhost";
  28. d.DiscoveryServerProt = 8500;
  29. d.CurrentNodeHostName = "localhost";
  30. d.CurrentNodePort = 5800;
  31. d.NodeName = "CAP 1号节点";
  32. });
  33. });
  34. services.AddMvc();
  35. }
  36. public void Configure(IApplicationBuilder app, IHostingEnvironment env, ILoggerFactory loggerFactory)
  37. {
  38. loggerFactory.AddConsole();
  39. loggerFactory.AddDebug();
  40. app.UseMvc();
  41. app.UseCap();
  42. app.UseCapDashboard();
  43. }
  44. }
  45. }