Azure App Service - how to configure port? [duplicate] - azure

This question already has an answer here:
socket.io client not connected to azure server created in socket.io
(1 answer)
Closed 18 days ago.
When I deploy example Spring Boot app to Azure App Service with Maven (just like in documentation), it works correctly regardles of server.port value in application.properties file. The App Service just "knows" what is the target port.
When I deploy other app, which is not based on Spring Boot and instead it is based on Tomcat Embedded and has port value hardcoded in its source code, the App Service does not work correctly. How can I "tell" the App Service what is the port that my app listens on?

App Service always listens on port 80/443. You can map to the port your app listening on setting the WEBSITES_PORT application setting to your app port number.

Related

Azure Functions with docker: How change port?

I have built a docker image using Spring Native. The Spring Boot application inside the container listens on port 80 but crashes on Azure Functions on startup because of missing access rights (it seems docker doesn't allow usage of ports bellow 1024). How can I change the port Azure Functions uses for accessing the application inside the docker image?
If you are using 80 or 8080, azure will auto-detect the used port.
Every other port can be configured using WEBSITES_PORT environment variable "Function App -> Settings -> Configuration -> New application settings" to something like 8081 (or that one, which the app listens on).

Application deployed in Azure VM

I have a react application deployed using an Azure virtual machine. To access the app I need to use configured DNS, for example, "http://XYZ.eastasia.cloudapp.azure.com:3000". However, I don't want to include the port num in the URL. How can I port forward in azure so that only by typing 'http://XYZ.eastasia.cloudapp.azure.com' should be enough to access the application?
If you want to users access your app by URL: http://XYZ.eastasia.cloudapp.azure.com, you should run your react app on 80 port. Refer to this post to specify a port to run react app.

Application Error message when browsing Azure deployed web app

I created a simple web app (serverless) and deployed the web app using Azure App Service VS Code extension. I chose Linus + Node LTS environment. I configured deployment source to a local Git repo (also tried remote GitHub repo) and deployed. The deployment shows successful message. But when I browse the site, it throws a message (after 3-4 mins) that there was an ":( Application error". The admin diagnostics link doesn't show any error. Any reason why this could be happening?
Where can I find error details?
The web app compiles/runs fine on the local host.
Enable Log Streamming, then you'll be able to figure out what the problem is:
https://learn.microsoft.com/en-us/azure/app-service/troubleshoot-diagnostic-logs
As another option, you can also instrument your application with Application Insights:
https://learn.microsoft.com/en-us/azure/azure-monitor/app/nodejs
On Azure WebApps, the container/application must respond to HTTP pings on the required port (check docker run command in the Log Stream) within 230 seconds, by default.
For a NodeJS app, you'd need to start the server in the following way:
const port = process.env.PORT || 1337;
server.listen(port);
Try deploying the sample available here:
https://github.com/Azure-Samples/nodejs-docs-hello-world
If that does not help, enable App Service Logs and check for any errors in the Log Stream.
I had created a NodeJS app which integrates with Application Insights some days back:
https://github.com/gkgaurav31/nodejs-application-insights-test-app
change your listen port either 8080 or 1337
By default, NodeJS webapp runs on port 8080. You are either running your port on some other port (Ex: 3000 or so) and then deploying it to webapp. Try changing your port in NodeJS app to 8080 and it should work.

Nodejs Loopback how to access api end points on live server?

I'm trying to deploy a Loopback project to live server, all works well on local. On server, after running node ., I get the console log of:
Web server listening at: http://domainname:3000
Browse your REST API at http://domainname:3000/explorer
So it looks like the server is running.
Problem is that I get no response from the server. Neither from domain:3000 or /explorer or any endpoint I created.
Does anyone know what might be the issue?
Thank you very much
I had a similar problem when I was trying to deploy my code. Some of the possible solutions to the problem depending on where and how you are deploying it-
Check if your security group allows connections on port 3000. AWS EC2 by default closes all ports except port 80. You might have to add an exception to your security group and allow port 3000 to be accessed from everywhere.
If you are using a container, check if your container has the ports open and if the container port is accessible by the hardware hosting the container. On Azure, I faced this problem as Azure Web App Container Service by default only listens to port 80 and 8080. So I had to modify my code such that it can use the default NODE_ENV.PORT or 8080.

Starting new port on Amazon Ec2 free tier for socket io

I am using Amazon EC2 service for the web purpose. I have a web application which is hosted on apache i.e port 80. Now i am running a node instance on port 3000 and when i load my website.
io.connect('http:IP ADDRESS:3000');
This code tries to connect to my port. On server side my instance is started. But when i load my we application, this doesnt connect to server.
I was wondering do i need to update my configuration or is there any network settings i need to do ?
Try adding your port in your defined security group.
Follow http://docs.amazonwebservices.com/AWSEC2/latest/UserGuide/using-network-security.html#concepts-security for more reference.

Resources