You cannot select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
|
|
|
|
using Microsoft.AspNetCore.Http.Features;
|
|
|
|
|
using Microsoft.AspNetCore.Server.Kestrel.Core;
|
|
|
|
|
using Ocelot.DependencyInjection;
|
|
|
|
|
using Ocelot.Middleware;
|
|
|
|
|
|
|
|
|
|
var builder = WebApplication.CreateBuilder(args);
|
|
|
|
|
|
|
|
|
|
// Add services to the container.
|
|
|
|
|
#region Cors<72><73><EFBFBD><EFBFBD>
|
|
|
|
|
builder.Services.AddCors(options =>
|
|
|
|
|
{
|
|
|
|
|
options.AddPolicy("all", builder =>
|
|
|
|
|
{
|
|
|
|
|
builder.SetIsOriginAllowed(origin => true) //<2F><><EFBFBD><EFBFBD><EFBFBD>κ<EFBFBD><CEBA><EFBFBD>Դ<EFBFBD><D4B4><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
|
|
|
|
.AllowAnyMethod()
|
|
|
|
|
.AllowAnyHeader()
|
|
|
|
|
.AllowCredentials();//ָ<><D6B8><EFBFBD><EFBFBD><EFBFBD><EFBFBD>cookie
|
|
|
|
|
});
|
|
|
|
|
});
|
|
|
|
|
#endregion
|
|
|
|
|
#region Body<64><79><EFBFBD><EFBFBD>
|
|
|
|
|
builder.Services.Configure<KestrelServerOptions>(options =>
|
|
|
|
|
{
|
|
|
|
|
options.Limits.MaxRequestBodySize = null;//<2F><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
|
|
|
|
});
|
|
|
|
|
builder.Services.Configure<IISServerOptions>(options =>
|
|
|
|
|
{
|
|
|
|
|
options.MaxRequestBodySize = null;//<2F><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
|
|
|
|
});
|
|
|
|
|
builder.Services.Configure<FormOptions>(x =>
|
|
|
|
|
{
|
|
|
|
|
x.ValueLengthLimit = int.MaxValue;
|
|
|
|
|
x.MultipartBodyLengthLimit = int.MaxValue;
|
|
|
|
|
x.MultipartHeadersLengthLimit = int.MaxValue;
|
|
|
|
|
});
|
|
|
|
|
#endregion
|
|
|
|
|
builder.Services.AddOcelot(builder.Configuration);
|
|
|
|
|
|
|
|
|
|
var app = builder.Build();
|
|
|
|
|
#region Cors<72><73><EFBFBD><EFBFBD>
|
|
|
|
|
app.UseCors("all");
|
|
|
|
|
#endregion
|
|
|
|
|
app.UseWebSockets();
|
|
|
|
|
app.UseOcelot((build, cfg) =>
|
|
|
|
|
{
|
|
|
|
|
build.BuildOcelotPipeline(cfg);
|
|
|
|
|
}).Wait();
|
|
|
|
|
app.Run();
|