问题描述
我有一个基于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服务器地址。
是什么原因导致此错误,我该如何解决?
解决方法
通过指定正确的端口解决了该问题。 :/