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���� #if DEBUG builder.Services.AddCors(options => { options.AddPolicy("all", builder => { builder.SetIsOriginAllowed(origin => true) //�����κ���Դ���������� .AllowAnyMethod() .AllowAnyHeader() .AllowCredentials();//ָ������cookie }); }); #endif #endregion var app = builder.Build(); // Configure the HTTP request pipeline. #region Cors���� #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();