servicestack - 使用 ServiceStacks JsonServiceClient 时的 Cors 配置问题
问题描述
尝试使用 ServiceStack 的 JsonServiceClient 将数据发布到我的 API 时遇到问题。
我在控制台中收到以下错误消息
访问从源“ http://192.168.10.191:5000 ”获取“ https://192.168.10.191:5001/json/reply/CreateEquipment ”已被 CORS 策略阻止:访问不允许请求标头字段标头预检响应中的 -Control-Allow-Headers。
我已将 192.168.10.191:5000 添加到白名单。
我可以在网络选项卡中看到它尝试访问“ https://192.168.10.191:5001/json/reply/CreateEquipment ”,但是当我使用 fiddler 捕获流量时没有显示任何内容。
我附上了标题的图像。https://i.stack.imgur.com/hUfII.png
解决方案
您在端口5001请求https资源,但您的原始白名单返回5000上的http资源,它们需要匹配。
推荐阅读
- sql - SQL 聚合函数 MAX 通过加入删除重复项
- c - 在 C 中“固定”大角度
- image-processing - 为什么我不能使 2D 高斯收敛?
- excel - 如何在特定文本上方添加空白行?
- node.js - React + NodeJS - nodemailer 谷歌云功能
- node.js - 使用 Typescript 为可能的 null 值添加一个接口
- visual-studio - 使用 MSBuild、VS 2019、Platform Toolset v142 编译时如何指定“目标平台版本”和“目标平台最低版本”
- laravel - 在 laravel mix 中使用 vue 或 jquery
- python - 如何在python中通过re从字符串中获取数字和字母?
- laravel - 从数据库中为通知中的不同电子邮件动态设置邮件驱动程序