Base solution for your next web application
Open Closed

[DEBUG] launch local angular-cli with remote internet server #4412


User avatar
0
daws created

Dear support,

i've deployed successfully my app on production server (cf case 1 below) and works fine (intranet & internet).

Now (case 2), I try to launch the client (angular-cli on my VSCode) from outside the production server and use the remote Web.Host as backend. Goal is to allows me to develop some UI stuff with my production data.

I think it's only related to my network configuration but I want to make sure I didn't forgot anything on my settings.

<ins>Global details</ins>

  • aspnetzero 5.0.6 .net with separate host (.net core) and client (angular)
  • IIS server on private remote server (NOT azure)
  • IIS routing module installed, all other installation of IIS is ok (application Pool, web.config, etc)
  • LOCAL : development machine (behind router)
  • PRODUCTION : external web server (IIS on internet public accessible server)

<ins>Case 1 : everything (Web.Host and angular) on PRODUCTION server</ins>

Everything works fine as expected.

<ins>Angular</ins>

"remoteServiceBaseUrl": "http://PRODUCTION-public-ip:5000",
"appBaseUrl": "http://PRODUCTION-public-ip:4200",

<ins>Web.Host</ins>

"App": {
	"ServerRootAddress": "http://PRODUCTION-public-ip:5000/",
	"ClientRootAddress": "http://PRODUCTION-public-ip:4200",
	"CorsOrigins": "http://PRODUCTION-public-ip:4200"
},

<ins>Case 2 : PRODUCTION Web.Host accessed from angular LOCAL</ins>

<ins>Details</ins>

  • all firewall are disabled (on PRODUCTION and LOCAL side)
  • angular-cli launched from VSCode
  • NSWAGGER HTTP Interface from Web.Host PRODUCTION is accessible from internet.
  • development machine is under intranet connected & accessible from internet
  • router forward TCP 4200 between external and development machine (port check + communication is ok)
  • Angular App (launched from vsCode) is accessible from intranet AND internet. (but it only throws back the error)

<ins>Angular</ins>

"remoteServiceBaseUrl": "http://PRODUCTION-public-ip:5000",
"appBaseUrl": "http://LOCAL-public-ip:4200",

<ins>Web.Host</ins>

"App": {
	"ServerRootAddress": "http://PRODUCTION-public-ip:5000/",
	"ClientRootAddress": "http://LOCAL-public-ip:4200",
	"CorsOrigins": "http://LOCAL-public-ip:4200"
},

with angular-CLI launched via differents parameters for test :

  • ng server ==> (<a class="postlink" href="http://localhost:4200">http://localhost:4200</a>)
  • ng server --host LOCAL-local-ip ==> (<a class="postlink" href="http://LOCAL-">http://LOCAL-</a>local-ip:4200)
  • ng server --host LOCAL-public-ip ==> (<a class="postlink" href="http://LOCAL-">http://LOCAL-</a>public-ip:4200) but, when i start the angular-app, i've ""An error has occured!" Error detail not sent by server. No log available on Web.Host\App_Data\Logs\Logs.txt or on vscode server.

so, angularApp is accessible from intranet+internet but doesn't seems to communicate with the server correctly.

Do you see anything that i did wrong ?

Regards,

daws


2 Answer(s)
  • User Avatar
    0
    daws created

    nevermind, case 2 works with :

    "remoteServiceBaseUrl": "http://PRODUCTION-public-ip:5000", "appBaseUrl": "http://localhost:4200",

    (+ port forwarding 4200 from router to my local pc)

    I don't know why it wouldn't work the 1st time, that's will stay a mystery.

    Subject closed :)

  • User Avatar
    0
    ismcagdas created
    Support Team

    Thanks for the feedback @daws :)