.net6跨域设置

刚开始的设置

cs 复制代码
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

cs 复制代码
services.AddCors();
app.UseCors(builder => builder
    .AllowAnyOrigin()
    .AllowAnyMethod()
    .AllowAnyHeader()
    );
相关推荐
2395730494 小时前
从 GUI 彻底转向 CLI:我用 .NET + Avalonia + NativeAOT 打造了 Agent 终端托管工具 Octopus
开源·.net·agent·avalonia·ai coding
Jeff-Tsai17 小时前
Day 28:DateTime 的时区转换
.net·架构设计·erp·definition-driven
IT规划师18 小时前
Redis 核心机制 | Lua 脚本:服务端原子操作·架构决策与生产落地
redis·.net
Jeff-Tsai1 天前
Day 27:Date、DateTime 与 Time 的语义分界
.net·架构设计·erp·definition-driven
sleveen2 天前
新增办理动词只写 Core:SailFlow 动作骨架、同事务信封与 Sync 钩子自锁治理
开源·.net·工作流·oa引擎
Jeff-Tsai3 天前
Day 26:数值语义、多币种与计量单位
.net·架构设计·erp·definition-driven
风云3 天前
两条 Pipe、五个命门:Vane.NET 内核为什么长这样
开源·网络编程·.net·架构设计·vane.net
宝桥南山3 天前
Visual Studio 2026新特性 - 可以直接连接DeepSeek(使用Custom Endpoint Provider配置项)
ide·microsoft·微软·aigc·.net·visual studio
Jeff-Tsai4 天前
Day 25:审计轨迹与变更的前后值
.net·架构设计·erp·definition-driven
IT规划师4 天前
Redis 核心机制 | 事务:执行序列的原子性、乐观锁与 8.x 条件写
redis·.net