2017-10-09 9 views
0

私のアプリケーションをローカルで(localhostを使って)実行すると完全に動作します。フロントエンドがバックエンドから情報を取得しないのはなぜですか?

しかし、グローバルIPアドレスに切り替えることにしたとき(私はグローバルと言うと、自分のLAN IPアドレスではなく、ISPから与えられたものです)。

バックエンドのデータはロードされません。

これは私が私のフロントエンドからの要求を行う方法です:

this.http.get("http://my-isp-ip:52899/api/Student/ListStudents").subscribe(response => { 
     this.users = response["Users"]; 
    }); 

そして、これは私が私のバックエンドに私のapplicationHost.configを得た方法である:

<bindings> 
        <binding protocol="http" bindingInformation="*:52899:localhost" /> 
        <binding protocol="http" bindingInformation="*:52899:my-isp-ip" /> 
       </bindings> 

そして、私は実行フロントエンドのアプリケーションは次のようになります: ng serve --host 0.0.0.0

そして、私はすでにルーターとファイアウォールの両方でポートを開いています。

私のルーターでは、フロントエンドで稼働しているのは45510764714​​、バックエンドで稼働しているのは52889です。

どうしたらいいですか?

+0

これは '0.0を--host変更してみてくださいする可能性があり.0.0'〜 '--host my-isp' –

+0

私はすでにそれを試みました、そして、それはipが束縛できないと言います。 – RottenCheese

答えて

0

ソリューション: 私が変更されました:

<bindings> 
    <binding protocol="http" bindingInformation="*:52899:localhost" /> 
    <binding protocol="http" bindingInformation="*:52899:my-isp-ip" /> 
</bindings> 

た:

<bindings> 
    <binding protocol="http" bindingInformation="*:52899:localhost" /> 
    <binding protocol="http" bindingInformation="*:52899:*" /> 
</bindings> 

、管理者としてのVisual Studioを実行します...

関連する問題