У меня есть докер Dot Net Core в облаке, и там также развернут API остальных
Я могу вызвать API WordPress Rest в моем ионном приложении
, но не могу вызвать метод get в моем ядре Dot Netapi
это мое ядро dot net api
файл контроллера
public class SessionController : ControllerBase
{
// GET /api/session/20/1/1/0/0/0
[HttpGet("{Count}/{page}/{CourseID}/{CategoryID}/{ItemOrder}/{Tadvin}")]
public string Get(int Count, int page, int CourseID, int CategoryID, int ItemOrder, int Tadvin)
{
string url = "http://webservice.mydomain.com/Mainservice.asmx?op=GetSession";
string body = "<?xml version=\"1.0\" encoding=\"utf-8\"?><soap:Envelope xmlns:xsi=\"http://www.w3.org/2001/XMLSchema-instance\" xmlns:xsd=\"http://www.w3.org/2001/XMLSchema\" xmlns:soap=\"http://schemas.xmlsoap.org/soap/envelope/\"> <soap:Body> <GetSessions xmlns=\"http://tempuri.org/\">"
+ " <Count>" + Count + "</Count>"
+ " <page>" + page + "</page>"
+ " <CourseID>" + CourseID + "</CourseID>"
+ " <CategoryID>" + CategoryID + "</CategoryID>"
+ " <ItemOrder>" + ItemOrder + "</ItemOrder>"
+ " <Tadvin>" + Tadvin + "</Tadvin>"
+ " <SearchPhrase></SearchPhrase> </GetSessions> </soap:Body></soap:Envelope>";
Xml2json _xml2json = new Xml2json(url, body);
return _xml2json.xml2json();
}
он также возвращает мне json
{"soap:Body":{"GetSessionsResponse":{"@xmlns":"http://tempuri.org/","GetSessionsResult":{"SessionInfo":[{"ID":"173","Number":"1","Name":"درآمدی بر سیاستگذاری، تصمیمسازی و چارهاندیشی","Date":"1385/11/05","Master":"حسن عباسی","CourseName":"کلبه کرامت (دوره یکم)","CategoryID":"20","Category":"رویکرد تصمیممدار","FilmURL":"http://blob.org/video/nq/001.mp4","FilmSize":"277387181","FilmDuration":"01:18:40","SesDocIDs":{"string":["59","60","61","68","2759"]}},{"ID":"334","Number":"2","Name":"درآمدی بر دکترینولوژی (1)","Date":"1385/11/05","Master":"حسن عباسی","CourseName":"کلبه کرامت (دوره یکم)","CategoryID":"42","Category":"علوم اقتدارآفرین","FilmURL":"ht..................
я могу позвонить этому почтальону и Google Chrome, но при вызове через ионное приложение это возвращает мне ошибку
Access to XMLHttpRequest at 'https://dacis.cloud.run/api/session/20/1/1/0/0/0' from origin 'http://localhost:8100' has been blocked by CORS policy: No 'Access-Control-Allow-Origin' header is present on the requested resource. core.js:1350 ERROR HttpErrorResponse {headers: HttpHeaders, status: 0, statusText: "Unknown Error", url: null, ok: false, …} polyfills.js:3 Cross-Origin Read Blocking (CORB) blocked cross-origin response https://dacis.cloud.run/api/session/20/1/1/0/0/0 with MIME type text/plain. See https://www.chromestatus.com/feature/5629709824032768 for more details.`
это мой ионный файл rest.ts:
getPosts(page): Observable<any[]> {
let URL2 = this.apiUrl + this.apiFolder ;
//'/Sessions/?token=asdfadsfklajdhi849hjbsvdsv&page=' + page;
return this.http.get("https://dacis.liara.run/api/session/20/1/1/0/0/0")
//.catch(this.handleError);
.catch((err) => {
// Do messaging and error handling here //TODO: add service to send message for pages
return Observable.throw(err)
})
}