.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()
    );
相关推荐
!chen3 小时前
SignalR移植到Esp32小智设备无缝连接.NET功能拓展MCP服务
windows·.net
码云数智-园园3 小时前
从 ASP.NET MVC 到现代 .NET:一份完整的迁移升级指南
asp.net·mvc·.net
lfq7612043 小时前
.NET Framework 下 C# MVC 项目敏感信息安全存储方法
安全·c#·mvc·.net
PfCoder2 天前
C#中定时器之System.Timers.Timer
c#·.net·visual studio·winform
ahxdyz2 天前
.NET平台MCP
ai·.net·mcp
の天命喵星人2 天前
.net 使用NLog记录日志
.net
绿荫阿广2 天前
将SignalR移植到Esp32—让小智设备无缝连接.NET功能拓展MCP服务
.net·asp.net core·mcp
有来技术2 天前
ASP.NET Core 权限管理系统(RBAC)设计与实现|vue3-element-admin .NET 后端
vue.js·后端·c#·asp.net·.net
云草桑2 天前
15分钟快速了解 Odoo
数据库·python·docker·postgresql·.net·odoo
Traced back2 天前
SQL Server数据自动清理系统最终版(C# WinForms完整源码)
数据库·c#·.net