cors
This commit is contained in:
parent
c661201812
commit
806c0eaf76
12
Program.cs
12
Program.cs
@ -5,6 +5,16 @@ var builder = WebApplication.CreateBuilder(args);
|
|||||||
builder.Services.AddControllers();
|
builder.Services.AddControllers();
|
||||||
// Learn more about configuring Swagger/OpenAPI at https://aka.ms/aspnetcore/swashbuckle
|
// Learn more about configuring Swagger/OpenAPI at https://aka.ms/aspnetcore/swashbuckle
|
||||||
builder.Services.AddEndpointsApiExplorer();
|
builder.Services.AddEndpointsApiExplorer();
|
||||||
|
|
||||||
|
|
||||||
|
builder.Services.AddCors(setup =>
|
||||||
|
{
|
||||||
|
setup.AddDefaultPolicy(policyBuilder =>
|
||||||
|
{
|
||||||
|
policyBuilder.WithOrigins("http://www.vdk2ch.ru:4200");
|
||||||
|
});
|
||||||
|
|
||||||
|
});
|
||||||
//builder.Services.AddSwaggerGen();
|
//builder.Services.AddSwaggerGen();
|
||||||
|
|
||||||
var app = builder.Build();
|
var app = builder.Build();
|
||||||
@ -18,6 +28,8 @@ if (app.Environment.IsDevelopment())
|
|||||||
|
|
||||||
//app.UseHttpsRedirection();
|
//app.UseHttpsRedirection();
|
||||||
|
|
||||||
|
app.UseCors();
|
||||||
|
|
||||||
app.UseAuthorization();
|
app.UseAuthorization();
|
||||||
|
|
||||||
app.MapControllers();
|
app.MapControllers();
|
||||||
|
Reference in New Issue
Block a user