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.

пре 6 година
1234567891011121314151617181920212223242526272829303132333435363738394041
  1. using Microsoft.AspNetCore.Builder;
  2. using Microsoft.AspNetCore.Hosting;
  3. using Microsoft.AspNetCore.Mvc;
  4. using Microsoft.Extensions.Configuration;
  5. using Microsoft.Extensions.DependencyInjection;
  6. using MongoDB.Driver;
  7. namespace Sample.RabbitMQ.MongoDB
  8. {
  9. public class Startup
  10. {
  11. public Startup(IConfiguration configuration)
  12. {
  13. Configuration = configuration;
  14. }
  15. public IConfiguration Configuration { get; }
  16. public void ConfigureServices(IServiceCollection services)
  17. {
  18. services.AddSingleton<IMongoClient>(new MongoClient("mongodb://192.168.10.110:27017,192.168.10.110:27018,192.168.10.110:27019/?replicaSet=rs0"));
  19. services.AddCap(x =>
  20. {
  21. x.UseMongoDB("mongodb://192.168.10.110:27017,192.168.10.110:27018,192.168.10.110:27019/?replicaSet=rs0");
  22. x.UseRabbitMQ("localhost");
  23. x.UseDashboard();
  24. });
  25. services.AddMvc().SetCompatibilityVersion(CompatibilityVersion.Version_2_1);
  26. }
  27. public void Configure(IApplicationBuilder app, IHostingEnvironment env)
  28. {
  29. if (env.IsDevelopment())
  30. {
  31. app.UseDeveloperExceptionPage();
  32. }
  33. app.UseMvc();
  34. }
  35. }
  36. }