修复跨域问题
This commit is contained in:
+10
@@ -31,7 +31,17 @@ builder.Services.AddSingleton<MtApi5Client>(sp =>
|
||||
});
|
||||
builder.Services.AddSingleton(new SemaphoreSlim(1, 1));
|
||||
builder.Services.AddHostedService<MtConnectionService>();
|
||||
builder.Services.AddCors(options =>
|
||||
{
|
||||
options.AddDefaultPolicy(policy =>
|
||||
{
|
||||
policy.AllowAnyOrigin()
|
||||
.AllowAnyMethod()
|
||||
.AllowAnyHeader();
|
||||
});
|
||||
});
|
||||
var app = builder.Build();
|
||||
app.UseCors();
|
||||
|
||||
app.UseExceptionHandler(errorApp =>
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user