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.

Startup.cs 1.0 KiB

7 vuotta sitten
7 vuotta sitten
1234567891011121314151617181920212223242526272829303132333435363738394041
  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. });
  25. services.AddMvc();
  26. }
  27. public void Configure(IApplicationBuilder app, IHostingEnvironment env, ILoggerFactory loggerFactory)
  28. {
  29. loggerFactory.AddConsole();
  30. loggerFactory.AddDebug();
  31. app.UseMvc();
  32. app.UseCap();
  33. }
  34. }
  35. }