.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()
    );
相关推荐
geovindu17 小时前
CSharp: Iterative Algorithms
开发语言·后端·算法·c#·.net·迭代算法
geovindu3 天前
CSharp: Flyweight Pattern
开发语言·后端·c#·.net·享元模式·结构型模式
驰骋工作流3 天前
请假流程:六款.NET工作流引擎实现方式对比
.net·ccflow·工作流引擎二开·.net工作流引擎对比
WarPigs3 天前
.NET项目app.Config笔记
c#·.net
海盗12344 天前
微软技术周报——2026-07-22
microsoft·c#·.net
海盗12344 天前
微软技术日报 ——2026-07-21
microsoft·c#·.net
半亩码田4 天前
【.NET新特性·第8篇】.NET 9 AI 构建基块:Microsoft.Extensions.AI
人工智能·microsoft·.net
Ctrl+Z侠5 天前
.NET WebApi Windows / Linux Docker 全链路压测与瓶颈定位 0 到 1 教程
linux·windows·.net
慧都小妮子5 天前
Aspose.CAD for .NET 26.6 更新发布
pdf·.net·3d渲染·cad·pdf导出·ifc编辑
夜莺悠吟5 天前
关于对 C# 中 ImplicitUsings,GlobalUsings 的讨论
c#·.net