jquery - 通过 https 调用在 localhost 上运行的 Owin 服务
问题描述
我有一个基于 Microsoft.Owin.Hosting 的 Web 服务,通过 https 在端口 8443 上本地运行。我已将证书绑定到它,并且能够使用 Web 服务器地址 https://localhost:8443/queryendpoint 使用 Chrome 进行连接。但是,我想使用在该机器上的客户端浏览器页面中运行的脚本来调用 Web 服务。
$.ajax({
headers:{
"Accept":"application/json",
"Content-type":"application/x-www-form-urlencoded"
},
type: "GET",
"rejectUnauthorized": false,
url:"https://localhost:8433/queryendpoint",
success:function(response){
var r=JSON.parse(response);
.
.
.
}
});
脚本运行时会导致错误:
GET https://localhost:8433/queryendpoint net::ERR_CONNECTION_REFUSED
该错误还会返回从 Postman 调用 Web 服务器地址。
是什么导致了这个错误,我该如何解决?
解决方案
该问题已通过指定正确的端口得到解决。:/
推荐阅读
- python - 将 html 表格转换为 json nice 格式
- reactjs - 使用 Jest 和 Enzyme 模拟“提交”后测试更新的状态
- javascript - 使用 Azure 应用服务部署的 Angular 应用找不到使用 ng serve 时找到的资产
- java - java Random() 如何找到种子?
- python - 在 DRF 的 @action 上使用 partial() 会给出 TypeError: "multiple values for argument"
- r - 闪亮的仪表板产生此错误:您将函数作为全局数据传递。您是否拼错了 `ggplot()` 中的 `data` 参数
- javascript - 如何从 asp net mvc 使用 https api
- r - 计算R中两个非零需求之间的间隔期
- javascript - Mongoose 中的 Model.findById() - 异步/等待
- python - 无法将用户输入与openpyxl中的单元格值进行比较