终端一体化运控平台
Вы не можете выбрать более 25 тем Темы должны начинаться с буквы или цифры, могут содержать дефисы(-) и должны содержать не более 35 символов.
 
 
 

41 строка
1.0 KiB

  1. using BPASmartClient.AgvApi;
  2. using Microsoft.AspNetCore.Cors.Infrastructure;
  3. var builder = WebApplication.CreateBuilder(args);
  4. // Add services to the container.
  5. builder.Services.AddControllers();
  6. // Learn more about configuring Swagger/OpenAPI at https://aka.ms/aspnetcore/swashbuckle
  7. builder.Services.AddEndpointsApiExplorer();
  8. builder.Services.AddSwaggerGen();
  9. builder.Services.AddSignalR();//×¢²áSignalR×é¼þ
  10. var app = builder.Build();
  11. // Configure the HTTP request pipeline.
  12. if (app.Environment.IsDevelopment())
  13. {
  14. app.UseSwagger();
  15. app.UseSwaggerUI();
  16. }
  17. app.Use(async (context, next) =>
  18. {
  19. context.Request.Headers["appKey"] = "0123456789abcdef";
  20. context.Response.Headers["appSecret"] = "0123456789abcdef";
  21. context.Response.Headers["requestId"] = "5f643ece-dc53-4d55-8e5f-d1e2dfd6a6d0";
  22. context.Response.Headers["timestamp"] = DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss");
  23. context.Response.Headers["version"] = "2.8";
  24. await next();
  25. });
  26. app.UseAuthorization();
  27. app.MapControllers();
  28. app.MapHub<PersonHub>("/personhub");
  29. app.Run();