简体   繁体   English

向带有ionic的iis服务器的http请求的未知HTTP错误

[英]Unknown http error with http request to an iis server with ionic

I've got a problem with my ionic app. 离子应用程序出现问题。 I try to get a json object from my iis (asp.NET) server. 我尝试从iis(asp.NET)服务器获取一个json对象。 But the request doesn't even come into my controller. 但是请求甚至没有进入我的控制器。 Everytime, i get the same error: 每次,我都会遇到相同的错误:

http failure response for (unknown url) 0 unknown error 针对(未知网址)的HTTP故障响应0未知错误

At first, I thought it was just a cors problem so i fixed it but now, it works with chrome and internet explorer 11 but not with edge and, more important, it doesn't work on device. 起初,我认为这只是一个cors问题,所以我将其修复,但现在,它可以与chrome和Internet Explorer 11一起使用,但不能与edge一起使用,更重要的是,它不适用于设备。 I don't think the problem is with my typescript code since there is no problem with a Google request... But, just in case, there is my code: 我认为我的打字稿代码没有问题,因为Google请求没有问题...但是,以防万一,这里有我的代码:

this.http.get('http://localhost:60196', {withCredentials : true}).subscribe(data => {
  this.testData = JSON.stringify(data);
}, err => {
  this.testData = JSON.stringify(err);
});

For the record: my iis server use windows impersonation and my app must run on windows devices (i didn't try my code with android or ios devices). 作为记录:我的iis服务器使用Windows模拟,并且我的应用程序必须在Windows设备上运行(我没有在android或ios设备上尝试过我的代码)。

Thank you very much. 非常感谢你。

it doesn't work on device 在设备上不起作用

this.http.get('http://localhost:60196', {withCredentials : true}).subscribe(data => {
  this.testData = JSON.stringify(data);
}, err => {
  this.testData = JSON.stringify(err);
});

Get request is rerencing to localhost . 获取请求正在还原到localhost Here should be some Api endpoint when testing it on device... 在设备上进行测试时,这里应该是一些Api端点...

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM