Sarath Sannadi
Sarath Sannadi

Reputation: 27

Error while browsing angular 8 app which is deployed in Azure

Please let me know why i am seeing below error when browsing angular app( version 8), my default app runs on localhost:4200 but i get error when i try to browse in azure, i am using azure app service extension in visual code and deploying through that and i dint see any error while deploying, i read some one mentioning adding port in config would resolve the issue, but it didn't, let me know what i am missing here.

Config file with port number

enter image description here

error in azure log stream

enter image description here

Upvotes: 0

Views: 191

Answers (2)

rohit
rohit

Reputation: 704

Azure App service only supports port 80/443. You can do app.listen(process.env.PORT); in your code. I had a similar issue when hosting node app. See here.

Upvotes: 1

Joey Cai
Joey Cai

Reputation: 20067

Build the web application before deploying with the ng build* command. This command will create the dist/project-sample directory containing a transpiled, minified, ready-to-deploy version of your application.

Deploying to an Azure Web App is as simple as right-clicking on the web app in the Azure App Service extension and selecting the “Deploy to Web App” option. The extension will make a suggestion on what to deploy but use the Browse option to select the dist/project-sample folder instead.

Also the default version of Node on the Azure Web App is not the version that you want to use. Luckily, the version of node can be changed with the WEBSITE_NODE_DEFAULT_VERSION with value 10.16.0. environment variable. Navigate to the Application settings section of the Application settings page for your Azure Web App.

For more details, you could refer to this article. BTW, check your web.config with this SO thread.

Upvotes: 1

Related Questions