|
- using System;
- using System.Collections.Generic;
- using System.Linq;
- using System.Threading.Tasks;
- using Microsoft.AspNetCore.Builder;
- using Microsoft.AspNetCore.Hosting;
- using Microsoft.Extensions.DependencyInjection;
- using Microsoft.Extensions.Logging;
-
- namespace Sample.RabbitMQ.MySql
- {
- public class Startup
- {
- public void ConfigureServices(IServiceCollection services)
- {
- services.AddDbContext<AppDbContext>();
-
- services.AddCap(x =>
- {
- x.UseEntityFramework<AppDbContext>();
- x.UseRabbitMQ(y => {
- y.HostName = "192.168.2.206";
- y.UserName = "admin";
- y.Password = "123123";
- });
- x.UseDashboard();
- x.UseDiscovery(d =>
- {
- d.DiscoveryServerHostName = "localhost";
- d.DiscoveryServerProt = 8500;
- d.CurrentNodeHostName = "localhost";
- d.CurrentNodePort = 5800;
- d.NodeName = "CAP 1号节点";
- });
- });
-
- services.AddMvc();
- }
-
- public void Configure(IApplicationBuilder app, IHostingEnvironment env, ILoggerFactory loggerFactory)
- {
- loggerFactory.AddConsole();
- loggerFactory.AddDebug();
-
- app.UseMvc();
-
- app.UseCap();
- app.UseCapDashboard();
- }
- }
- }
|