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 ZhongLianService;
|
|
|
using Newtonsoft.Json.Serialization;
|
|
|
using Newtonsoft.Json;
|
|
|
|
|
|
var builder = WebApplication.CreateBuilder(args);
|
|
|
|
|
|
// Add services to the container.
|
|
|
|
|
|
builder.Services.AddControllers().AddNewtonsoftJson(options =>
|
|
|
{
|
|
|
options.SerializerSettings.ContractResolver = new DefaultContractResolver();
|
|
|
|
|
|
options.SerializerSettings.NullValueHandling = NullValueHandling.Ignore;
|
|
|
}).AddDapr();
|
|
|
// Learn more about configuring Swagger/OpenAPI at https://aka.ms/aspnetcore/swashbuckle
|
|
|
builder.Services.AddEndpointsApiExplorer();
|
|
|
builder.Services.AddSwaggerGen();
|
|
|
builder.Services.InitZhongLianService(builder.Configuration);
|
|
|
#region Cors<72><73><EFBFBD><EFBFBD>
|
|
|
#if DEBUG
|
|
|
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
|
|
|
});
|
|
|
});
|
|
|
#endif
|
|
|
#endregion
|
|
|
|
|
|
var app = builder.Build();
|
|
|
|
|
|
// Configure the HTTP request pipeline.
|
|
|
#region Cors<72><73><EFBFBD><EFBFBD>
|
|
|
#if DEBUG
|
|
|
app.UseCors("all");
|
|
|
#endif
|
|
|
#endregion
|
|
|
app.UseSwagger();
|
|
|
app.UseSwaggerUI();
|
|
|
app.UseHttpsRedirection();
|
|
|
app.UseRouting();
|
|
|
app.UseAuthorization();
|
|
|
app.UseStaticFiles();
|
|
|
#if !DEBUG
|
|
|
app.MapActorsHandlers();
|
|
|
#endif
|
|
|
app.MapControllers();
|
|
|
app.Run();
|