第七色在线视频,2021少妇久久久久久久久久,亚洲欧洲精品成人久久av18,亚洲国产精品特色大片观看完整版,孙宇晨将参加特朗普的晚宴

為了賬號安全,請及時綁定郵箱和手機立即綁定
已解決430363個問題,去搜搜看,總會有你想問的

同一服務器上的兩個項目具有不同的端口但客戶端(Angular 6)無法調用服務器

同一服務器上的兩個項目具有不同的端口但客戶端(Angular 6)無法調用服務器

有只小跳蛙 2021-10-13 15:58:25
更新我在一臺服務器上放置了兩個項目,它們是客戶端和服務器 RestAPI 應用程序。我將 4200 設置為客戶端的端口(由 Angular 6 編寫)和服務器端 WebSrv 的端口 8990。我使用命令運行 Spring one java -jar artifact.jar,它工作正常并響應任何請求。但是對于客戶端,當我從本地機器使用 IP 運行它時:localhost:4200(使用 IntellijIdea 內置構建器或使用 Angular CLI)它工作正常并且可以發(fā)送請求并接收響應。但是,當我從該服務器(WebSrv 服務器所在的位置)運行它并運行時,它正確顯示了第一個 html 頁面,但是當我單擊發(fā)送請求的按鈕時,沒有任何反應(也沒有異?;蛉魏稳罩荆┎⑶曳掌鞑皇墙邮苋魏我螅?!我已經搜索了我的問題,但沒有任何幫助。如果有人能幫助我找到解決方案,我將不勝感激。我想知道是否有人知道是什么問題。這是我的客戶端代碼(Angular)import {Component, NgModule, OnInit} from '@angular/core';import {HttpClient, HttpHeaders} from '@angular/common/http';import {RouterModule, Router} from '@angular/router';// const URL = 'http://localhost:8990/getUserId';const URL = 'http://getuserid.mycompany.com:8990/getUserId';@Component({  selector: 'app-root',  templateUrl: './app.component.html',  styleUrls: ['./app.component.css']})export class AppComponent {  constructor(    private http: HttpClient  ) {  }  fileToUpload: File = null;  id: String = '0';  inputId(event) {    this.id = event.target.value;    console.log('id is -- > ' + event.target.value);  }  inputFile(event) {    this.fileToUpload = event.target.files[0];    console.log('File path -- > ' + event.target.files[0].name);  }  onSubmit(id: string, file: File) {    const frmData = new FormData();    console.log('POST');    // @ts-ignore    frmData.append('id', this.id);    frmData.append('inputPackage', this.fileToUpload);    console.log('id --> ' + this.id);    console.log('File name --> ' + this.fileToUpload.name);     this.http.post(URL, frmData).subscribe(res => {      const resp = JSON.parse(JSON.stringify(res));      if (resp['user'] != null) {          if (resp['user']['user-id'] === false) {             alert('Successful!! Your User ID is : ' + resp['user']['user-id']);           } else {            alert('Sorry!! Error occurred : ' + resp['error-message']);          }     } else {        alert('Sorry!! Error occurred : ' + resp['error-message'] );      }    });  }}
查看完整描述

1 回答

?
蠱毒傳說

TA貢獻1895條經驗 獲得超3個贊

問題是4200公司網絡部過濾的端口號。將端口更改為8080它后效果很好。


查看完整回答
反對 回復 2021-10-13
  • 1 回答
  • 0 關注
  • 223 瀏覽
慕課專欄
更多

添加回答

舉報

0/150
提交
取消
微信客服

購課補貼
聯系客服咨詢優(yōu)惠詳情

幫助反饋 APP下載

慕課網APP
您的移動學習伙伴

公眾號

掃描二維碼
關注慕課網微信公眾號