.net6跨域设置

刚开始的设置

services.AddCors();
app.UseCors(builder => builder
    .AllowAnyOrigin()
    .AllowAnyMethod()
    .AllowAnyHeader()
    .AllowCredentials());

启动项目报错

The CORS protocol does not allow specifying a wildcard (any) origin and credentials at the same time” error

修改代码去掉AllowCredentials

services.AddCors();
app.UseCors(builder => builder
    .AllowAnyOrigin()
    .AllowAnyMethod()
    .AllowAnyHeader()
    );

你可能感兴趣的:(dotnet,dotnet,.net,asp.net,core,跨域)